Skip to content

Commit 07ebc52

Browse files
committed
Document the impl_protocol macro
1 parent 94c07af commit 07ebc52

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/proto/macros.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
/// Implements the `Protocol` trait for a type.
22
/// Also marks the type as not sync and not send.
3+
///
4+
/// # Usage
5+
///
6+
/// ```rust
7+
/// struct CustomProtocol {
8+
/// function_pointer: extern "C" fn() -> (),
9+
/// data: usize
10+
/// }
11+
///
12+
/// impl_proto! {
13+
/// protocol CustomProtocol {
14+
/// GUID = 0x1234_5678, 0x9ABC 0xDEF0, [0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89];
15+
/// }
16+
/// }
17+
/// ```
318
macro_rules! impl_proto {
419
(
520
protocol $p:ident {

0 commit comments

Comments
 (0)