pub struct Status(_);
Expand description

Wrapper for a RawVal that is tagged with [Tag::Status], interpreting the RawVal’s body as a pair of a 28-bit status-type code and a 32-bit status code. The status-type codes correspond to the enumerated cases of ScStatusType, and the status codes correspond to the code values stored in each variant of the ScStatus union.

Implementations§

source§

impl Status

source

pub const fn as_raw(&self) -> &RawVal

source

pub const fn to_raw(&self) -> RawVal

source§

impl Status

source

pub const UNKNOWN_ERROR: Status = unsafe { Status::from_major_minor(0, ScStatusType::UnknownError as u32) }

source

pub const OK: Status = unsafe { Status::from_major_minor(0, ScStatusType::Ok as u32) }

source§

impl Status

source

pub const fn is_type(&self, ty: ScStatusType) -> bool

source

pub const fn get_code(&self) -> u32

source

pub const fn is_ok(&self) -> bool

source

pub const fn from_contract_error(code: u32) -> Status

source

pub const fn from_type_and_code(ty: ScStatusType, code: u32) -> Status

source

pub const fn from_status(sc: ScStatus) -> Status

Trait Implementations§

source§

impl AsMut<RawVal> for Status

source§

fn as_mut(&mut self) -> &mut RawVal

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<RawVal> for Status

source§

fn as_ref(&self) -> &RawVal

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Status

source§

fn clone(&self) -> Status

Returns a copy 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 Debug for Status

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<&Status> for RawVal

source§

fn from(b: &Status) -> RawVal

Converts to this type from the input type.
source§

impl From<ConversionError> for Status

source§

fn from(_: ConversionError) -> Status

Converts to this type from the input type.
source§

impl From<Error> for Status

source§

fn from(_value: Error) -> Status

Converts to this type from the input type.
source§

impl From<Infallible> for Status

source§

fn from(_: Infallible) -> Status

Converts to this type from the input type.
source§

impl From<ScHostAuthErrorCode> for Status

source§

fn from(code: ScHostAuthErrorCode) -> Status

Converts to this type from the input type.
source§

impl From<ScHostContextErrorCode> for Status

source§

fn from(code: ScHostContextErrorCode) -> Status

Converts to this type from the input type.
source§

impl From<ScHostFnErrorCode> for Status

source§

fn from(code: ScHostFnErrorCode) -> Status

Converts to this type from the input type.
source§

impl From<ScHostObjErrorCode> for Status

source§

fn from(code: ScHostObjErrorCode) -> Status

Converts to this type from the input type.
source§

impl From<ScHostStorageErrorCode> for Status

source§

fn from(code: ScHostStorageErrorCode) -> Status

Converts to this type from the input type.
source§

impl From<ScHostValErrorCode> for Status

source§

fn from(code: ScHostValErrorCode) -> Status

Converts to this type from the input type.
source§

impl From<ScStatus> for Status

source§

fn from(st: ScStatus) -> Status

Converts to this type from the input type.
source§

impl From<ScUnknownErrorCode> for Status

source§

fn from(code: ScUnknownErrorCode) -> Status

Converts to this type from the input type.
source§

impl From<ScVmErrorCode> for Status

source§

fn from(code: ScVmErrorCode) -> Status

Converts to this type from the input type.
source§

impl From<Status> for RawVal

source§

fn from(b: Status) -> RawVal

Converts to this type from the input type.
source§

impl From<SymbolError> for Status

source§

fn from(se: SymbolError) -> Status

Converts to this type from the input type.
source§

impl FromValue for Status

source§

fn from_value(val: Value) -> Option<Status>

Create a value of type Self from a given Value. Read more
source§

impl Hash for Status

source§

fn hash<H>(&self, state: &mut H)where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Status

source§

fn cmp(&self, other: &Status) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Status> for Status

source§

fn eq(&self, other: &Status) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Status> for Status

source§

fn partial_cmp(&self, other: &Status) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl RawValConvertible for Status

source§

fn is_val_type(v: RawVal) -> bool

Returns true if v is in a union state compatible with Self.
source§

unsafe fn unchecked_from_val(v: RawVal) -> Status

Converts the bits making up a Val into Self without checking that the Val is tagged correctly, assuming that such a check has been performed elsewhere. It is the caller’s responsibility to arrange that such checks have occurred before calling unchecked_from_val, which is why it is marked as unsafe (it does not represent a risk of memory-unsafety, merely “serious logic errors”).
source§

fn try_convert(v: RawVal) -> Option<Self>

Attempt a conversion from Val to Self, returning None if the provided Val is not tagged correctly. By default this calls Self::is_val_type and Self::unchecked_from_val, but it can be customized on a type-by-type basis to avoid redundant tag tests and produce more efficient code, as it is done for Static values like bool.
source§

impl TryFrom<&RawVal> for Status

§

type Error = ConversionError

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

fn try_from(v: &RawVal) -> Result<Status, <Status as TryFrom<&RawVal>>::Error>

Performs the conversion.
source§

impl TryFrom<RawVal> for Status

§

type Error = ConversionError

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

fn try_from(v: RawVal) -> Result<Status, <Status as TryFrom<RawVal>>::Error>

Performs the conversion.
source§

impl TryFrom<Status> for ScStatus

§

type Error = Error

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

fn try_from( st: Status ) -> Result<ScStatus, <ScStatus as TryFrom<Status>>::Error>

Performs the conversion.
source§

impl TryFrom<Status> for ScVal

§

type Error = Error

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

fn try_from(st: Status) -> Result<ScVal, <ScVal as TryFrom<Status>>::Error>

Performs the conversion.
source§

impl<E> TryFromVal<E, RawVal> for Statuswhere E: Env,

source§

impl<E> TryFromVal<E, Status> for RawValwhere E: Env,

source§

impl Copy for Status

source§

impl Eq for Status

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T, C> Compare<&T> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare(&self, a: &&T, b: &&T) -> Result<Ordering, <C as Compare<&T>>::Error>

source§

impl<T, U, E, C> Compare<(T, U)> for Cwhere C: Compare<T, Error = E, Error = E> + Compare<U>,

§

type Error = E

source§

fn compare( &self, a: &(T, U), b: &(T, U) ) -> Result<Ordering, <C as Compare<(T, U)>>::Error>

source§

impl<T, U, V, E, C> Compare<(T, U, V)> for Cwhere C: Compare<T, Error = E, Error = E, Error = E> + Compare<U> + Compare<V>,

§

type Error = E

source§

fn compare( &self, a: &(T, U, V), b: &(T, U, V) ) -> Result<Ordering, <C as Compare<(T, U, V)>>::Error>

source§

impl<T, C> Compare<Box<T, Global>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Box<T, Global>, b: &Box<T, Global> ) -> Result<Ordering, <C as Compare<Box<T, Global>>>::Error>

source§

impl<T, C> Compare<Option<T>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Option<T>, b: &Option<T> ) -> Result<Ordering, <C as Compare<Option<T>>>::Error>

source§

impl<T, C> Compare<Rc<T>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Rc<T>, b: &Rc<T> ) -> Result<Ordering, <C as Compare<Rc<T>>>::Error>

source§

impl<E> Compare<Status> for Ewhere E: Env,

§

type Error = <E as EnvBase>::Error

source§

fn compare( &self, a: &Status, b: &Status ) -> Result<Ordering, <E as Compare<Status>>::Error>

source§

impl<T, C> Compare<Vec<T, Global>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Vec<T, Global>, b: &Vec<T, Global> ) -> Result<Ordering, <C as Compare<Vec<T, Global>>>::Error>

§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<E, T, U> TryIntoVal<E, T> for Uwhere E: Env, T: TryFromVal<E, U>,

§

type Error = <T as TryFromVal<E, U>>::Error

source§

fn try_into_val(&self, env: &E) -> Result<T, <U as TryIntoVal<E, T>>::Error>

§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V