pub struct CommandResponseTraitMethod<'a> {
pub command: &'a RecordType,
pub response: &'a DiscriminatedUnionType,
pub shapes: &'a [RecordType],
}Expand description
Generates the provided trait method for the ClientApi trait.
The ClientApi trait definition itself must be generated by the client and should look like this
ⓘ
pub trait ClientApi {
type Error;
fn send_raw(&self, command: String) -> impl Future<Output = Result<Arc<{}>, Self::Error>> + Send;
//..
}Then the provided methods could be inserted.
For methods that return multiple kinds a valid responses the additional wrapper type should be
generated. You can get this type definition using the
CommandResponseTraitMethod::response_wrapper method.
Fields§
§command: &'a RecordType§response: &'a DiscriminatedUnionType§shapes: &'a [RecordType]Implementations§
Source§impl<'a> CommandResponseTraitMethod<'a>
impl<'a> CommandResponseTraitMethod<'a>
pub fn new( command: &'a RecordType, response: &'a DiscriminatedUnionType, shapes: &'a [RecordType], ) -> Self
Source§impl<'a> CommandResponseTraitMethod<'a>
impl<'a> CommandResponseTraitMethod<'a>
Sourcepub fn response_wrapper(&self) -> Option<ResponseWrapperFmt>
pub fn response_wrapper(&self) -> Option<ResponseWrapperFmt>
If some method has multiple valid responses a helper type representing valid response variants must be generated.
If only one possible valid response is possible it can get inlined without extra helper
types and for this case this method returns None.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for CommandResponseTraitMethod<'a>
impl<'a> RefUnwindSafe for CommandResponseTraitMethod<'a>
impl<'a> Send for CommandResponseTraitMethod<'a>
impl<'a> Sync for CommandResponseTraitMethod<'a>
impl<'a> Unpin for CommandResponseTraitMethod<'a>
impl<'a> UnwindSafe for CommandResponseTraitMethod<'a>
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