pub struct EncodedOrderIntent(/* private fields */);Expand description
Canonical 213-byte representation of an OrderIntent. The wire format and
the order UID preimage.
Layout: one character per byte, cell widths proportional to field size,
each divider belongs to the cell on its right. The byte range is
annotated below. Amounts and valid_to are little-endian encoded.
flags ────┐
┌───────────────────────────────┬───────────────────────────────┬───────────────────────────────┬───────────────────────────────┬───────────────────────────────┬───────┬───────┬───┬┬───────────────────────────────┐
│ │ │ │ │ │sell_ │buy_ │val││ │
│ owner │ buy_token_account │ buy_mint │ sell_token_account │ sell_mint │ │ │id_││ app_data │
│ │ │ │ │ │amount │amount │to ││ │
└───────────────────────────────┴───────────────────────────────┴───────────────────────────────┴───────────────────────────────┴───────────────────────────────┴───────┴───────┴───┴┴───────────────────────────────┘
0 32 64 96 128 160 168 176 180 213
181Implementations§
Source§impl EncodedOrderIntent
impl EncodedOrderIntent
pub const SIZE: usize = 213
Sourcepub fn decode_and_hash(
bytes: &[u8; 213],
) -> Result<(OrderIntent, Hash), ProgramError>
pub fn decode_and_hash( bytes: &[u8; 213], ) -> Result<(OrderIntent, Hash), ProgramError>
Decode raw bytes to an OrderIntent and compute the UID in one shot.
Returns ProgramError::InvalidInstructionData for a flags byte that
doesn’t encode correctly; every other byte combination decodes.
Trait Implementations§
Source§impl Clone for EncodedOrderIntent
impl Clone for EncodedOrderIntent
Source§fn clone(&self) -> EncodedOrderIntent
fn clone(&self) -> EncodedOrderIntent
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 moreSource§impl Debug for EncodedOrderIntent
impl Debug for EncodedOrderIntent
Source§impl Deref for EncodedOrderIntent
impl Deref for EncodedOrderIntent
impl Eq for EncodedOrderIntent
Source§impl From<&EncodedOrderIntent> for [u8; 213]
impl From<&EncodedOrderIntent> for [u8; 213]
Source§fn from(encoded: &EncodedOrderIntent) -> Self
fn from(encoded: &EncodedOrderIntent) -> Self
Converts to this type from the input type.
Source§impl From<&OrderIntent> for EncodedOrderIntent
impl From<&OrderIntent> for EncodedOrderIntent
Source§fn from(intent: &OrderIntent) -> Self
fn from(intent: &OrderIntent) -> Self
Converts to this type from the input type.
Source§impl PartialEq for EncodedOrderIntent
impl PartialEq for EncodedOrderIntent
impl StructuralPartialEq for EncodedOrderIntent
Source§impl TryFrom<&EncodedOrderIntent> for OrderIntent
impl TryFrom<&EncodedOrderIntent> for OrderIntent
Source§type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for EncodedOrderIntent
impl RefUnwindSafe for EncodedOrderIntent
impl Send for EncodedOrderIntent
impl Sync for EncodedOrderIntent
impl Unpin for EncodedOrderIntent
impl UnsafeUnpin for EncodedOrderIntent
impl UnwindSafe for EncodedOrderIntent
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