Struct FinamCidCodec
pub struct FinamCidCodec;Expand description
Codec between the library’s client order id (a UUID) and the fields Finam stores on an order.
Implements [CidCodec]: encode makes the lossless text for the order
comment, decode reads it back. FinamCidCodec::client_order_id makes the
short, one-way tag for the client_order_id field.
The connector uses it on its own. You need it to read the cid out of an order you fetched through
raw(), or to find your order at the broker by its comment.
See the module docs for the reason for two fields.
Implementations§
§impl FinamCidCodec
impl FinamCidCodec
pub fn client_order_id(&self, cid: Uuid) -> String
pub fn client_order_id(&self, cid: Uuid) -> String
The 20 character tag for the client_order_id field of an order.
20 lowercase hex chars from 10 fully random bytes of the UUID (v4 version/variant skipped). It is one-way: 80 bits of 128 cannot rebuild the cid. It is only a second key for the case when the comment is missing in an echo.
pub fn validate(&self) -> Result<(), Error>
pub fn validate(&self) -> Result<(), Error>
Startup check: the formats must fit the broker limits, otherwise it is a configuration error, not a runtime degradation.
Encodes a sample cid, checks the length of the comment and of the tag, and decodes the
comment back. UserDataConnector::start calls it.
§Errors
[brokapi_core::Error::Config] when a form does not fit the documented limits
(COMMENT_MAX, CLIENT_ORDER_ID_MAX) or does not decode back to the same cid.
§Examples
use brokapi_finam::FinamCidCodec;
FinamCidCodec.validate().expect("the codec fits the documented Finam limits");Trait Implementations§
§impl CidCodec for FinamCidCodec
impl CidCodec for FinamCidCodec
§impl Clone for FinamCidCodec
impl Clone for FinamCidCodec
§fn clone(&self) -> FinamCidCodec
fn clone(&self) -> FinamCidCodec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FinamCidCodec
§impl Debug for FinamCidCodec
impl Debug for FinamCidCodec
§impl Default for FinamCidCodec
impl Default for FinamCidCodec
§fn default() -> FinamCidCodec
fn default() -> FinamCidCodec
Auto Trait Implementations§
impl Freeze for FinamCidCodec
impl RefUnwindSafe for FinamCidCodec
impl Send for FinamCidCodec
impl Sync for FinamCidCodec
impl Unpin for FinamCidCodec
impl UnsafeUnpin for FinamCidCodec
impl UnwindSafe for FinamCidCodec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>,
Layered].