pub struct ProtocolMessageGuardBuilder<InnerBuilder_: for<'this> FnOnce(&'this Bytes) -> ProtocolMessage<'this>> {
pub buffer: Bytes,
pub inner_builder: InnerBuilder_,
}Expand description
A more verbose but stable way to construct self-referencing structs. It is comparable to using StructName { field1: value1, field2: value2 } rather than StructName::new(value1, value2). This has the dual benefit of making your code both easier to refactor and more readable. Call build() to construct the actual struct. The fields of this struct should be used as follows:
| Field | Suggested Use |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> inner: _ |
Fields§
§buffer: Bytes§inner_builder: InnerBuilder_Implementations§
Source§impl<InnerBuilder_: for<'this> FnOnce(&'this Bytes) -> ProtocolMessage<'this>> ProtocolMessageGuardBuilder<InnerBuilder_>
impl<InnerBuilder_: for<'this> FnOnce(&'this Bytes) -> ProtocolMessage<'this>> ProtocolMessageGuardBuilder<InnerBuilder_>
Sourcepub fn build(self) -> ProtocolMessageGuard
pub fn build(self) -> ProtocolMessageGuard
Calls ProtocolMessageGuard::new() using the provided values. This is preferable over calling new() directly for the reasons listed above.
Auto Trait Implementations§
impl<InnerBuilder_> !Freeze for ProtocolMessageGuardBuilder<InnerBuilder_>
impl<InnerBuilder_> RefUnwindSafe for ProtocolMessageGuardBuilder<InnerBuilder_>where
InnerBuilder_: RefUnwindSafe,
impl<InnerBuilder_> Send for ProtocolMessageGuardBuilder<InnerBuilder_>where
InnerBuilder_: Send,
impl<InnerBuilder_> Sync for ProtocolMessageGuardBuilder<InnerBuilder_>where
InnerBuilder_: Sync,
impl<InnerBuilder_> Unpin for ProtocolMessageGuardBuilder<InnerBuilder_>where
InnerBuilder_: Unpin,
impl<InnerBuilder_> UnwindSafe for ProtocolMessageGuardBuilder<InnerBuilder_>where
InnerBuilder_: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more