pub struct ProtocolMessageGuardAsyncBuilder<InnerBuilder_: for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = ProtocolMessage<'this>> + '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) -> Pin<Box<dyn Future<Output = ProtocolMessage<'this>> + 'this>>> ProtocolMessageGuardAsyncBuilder<InnerBuilder_>
impl<InnerBuilder_: for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = ProtocolMessage<'this>> + 'this>>> ProtocolMessageGuardAsyncBuilder<InnerBuilder_>
Sourcepub async fn build(self) -> ProtocolMessageGuard
pub async 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 ProtocolMessageGuardAsyncBuilder<InnerBuilder_>
impl<InnerBuilder_> RefUnwindSafe for ProtocolMessageGuardAsyncBuilder<InnerBuilder_>where
InnerBuilder_: RefUnwindSafe,
impl<InnerBuilder_> Send for ProtocolMessageGuardAsyncBuilder<InnerBuilder_>where
InnerBuilder_: Send,
impl<InnerBuilder_> Sync for ProtocolMessageGuardAsyncBuilder<InnerBuilder_>where
InnerBuilder_: Sync,
impl<InnerBuilder_> Unpin for ProtocolMessageGuardAsyncBuilder<InnerBuilder_>where
InnerBuilder_: Unpin,
impl<InnerBuilder_> UnwindSafe for ProtocolMessageGuardAsyncBuilder<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