Skip to main content

SField

Struct SField 

Source
pub struct SField<T: LedgerObjectFieldGetter, const CODE: i32> { /* private fields */ }
Expand description

A type-safe wrapper for XRPL serialized field codes.

This struct encodes both the field code and the expected type as const generics, allowing the compiler to automatically infer the correct type when calling get_field.

§Example

use xrpl_wasm_stdlib::core::ledger_objects::ledger_object;
use xrpl_wasm_stdlib::sfield;

// Type is automatically inferred from the SField constant
let flags = ledger_object::get_field(0, sfield::Flags).unwrap();  // u32
let balance = ledger_object::get_field(0, sfield::Balance).unwrap();  // u64

Implementations§

Source§

impl<T: LedgerObjectFieldGetter, const CODE: i32> SField<T, CODE>

Source

pub const fn new() -> Self

Creates a new SField constant.

This is a const function that can be used to initialize SField constants.

Trait Implementations§

Source§

impl<T: Clone + LedgerObjectFieldGetter, const CODE: i32> Clone for SField<T, CODE>

Source§

fn clone(&self) -> SField<T, CODE>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: LedgerObjectFieldGetter, const CODE: i32> Default for SField<T, CODE>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: LedgerObjectFieldGetter, const CODE: i32> From<SField<T, CODE>> for i32

Source§

fn from(_: SField<T, CODE>) -> Self

Converts to this type from the input type.
Source§

impl<T: Copy + LedgerObjectFieldGetter, const CODE: i32> Copy for SField<T, CODE>

Auto Trait Implementations§

§

impl<T, const CODE: i32> Freeze for SField<T, CODE>

§

impl<T, const CODE: i32> RefUnwindSafe for SField<T, CODE>
where T: RefUnwindSafe,

§

impl<T, const CODE: i32> Send for SField<T, CODE>
where T: Send,

§

impl<T, const CODE: i32> Sync for SField<T, CODE>
where T: Sync,

§

impl<T, const CODE: i32> Unpin for SField<T, CODE>
where T: Unpin,

§

impl<T, const CODE: i32> UnsafeUnpin for SField<T, CODE>

§

impl<T, const CODE: i32> UnwindSafe for SField<T, CODE>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.