pub struct TbankCidCodec;Expand description
The client order id codec of T-Bank: the cid is sent as a hyphenated UUID.
A hyphenated UUID is exactly 36 characters, which is the limit of PostOrderRequest.order_id, so
the cid fits without loss and comes back unchanged in order_request_id. The connectors use this
codec for you. Use it yourself when you read broker messages outside the connector (for example
through TbankRaw) and want to know whether an order is yours.
§Examples
use brokapi_core::{CidCodec, ClientOrderId, NativeCid};
use brokapi_tbank::TbankCidCodec;
let codec = TbankCidCodec;
assert_eq!(codec.caps().max_len, 36);
assert!(codec.caps().lossless);
let cid = ClientOrderId::new_v4();
let native = codec.encode(cid).expect("a UUID always fits");
assert_eq!(native.as_str().len(), 36);
assert_eq!(codec.decode(&native), Some(cid));
// An id that is not a UUID was not placed by this library.
assert_eq!(codec.decode(&NativeCid::new("placed-by-hand")), None);Trait Implementations§
Source§impl CidCodec for TbankCidCodec
impl CidCodec for TbankCidCodec
Source§impl Clone for TbankCidCodec
impl Clone for TbankCidCodec
Source§fn clone(&self) -> TbankCidCodec
fn clone(&self) -> TbankCidCodec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TbankCidCodec
Source§impl Debug for TbankCidCodec
impl Debug for TbankCidCodec
Source§impl Default for TbankCidCodec
impl Default for TbankCidCodec
Source§fn default() -> TbankCidCodec
fn default() -> TbankCidCodec
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TbankCidCodec
impl RefUnwindSafe for TbankCidCodec
impl Send for TbankCidCodec
impl Sync for TbankCidCodec
impl Unpin for TbankCidCodec
impl UnsafeUnpin for TbankCidCodec
impl UnwindSafe for TbankCidCodec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].