pub struct Codec<A, R> {
pub decode: fn(Value) -> Result<A, String>,
pub encode: fn(R) -> Result<Value, String>,
}Expand description
How a method bound with Service::method_with reads its portable arguments and writes its
result, in place of serde, so its Rust types need no serde implementation.
Fields§
§decode: fn(Value) -> Result<A, String>Read the arguments’ JSON, or refuse it with a message: the call then fails with
Reason::Arguments before its callback runs.
encode: fn(R) -> Result<Value, String>Write the result as JSON, or refuse it with a message: the call then fails with
Reason::Result.
Auto Trait Implementations§
impl<A, R> Forget for Codec<A, R>
impl<A, R> Freeze for Codec<A, R>
impl<A, R> Move for Codec<A, R>
impl<A, R> RefUnwindSafe for Codec<A, R>
impl<A, R> Send for Codec<A, R>
impl<A, R> Sync for Codec<A, R>
impl<A, R> Unpin for Codec<A, R>
impl<A, R> UnsafeUnpin for Codec<A, R>
impl<A, R> UnwindSafe for Codec<A, R>
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