Spec

Struct Spec 

Source
pub struct Spec(pub Option<Vec<ScSpecEntry>>);

Tuple Fields§

§0: Option<Vec<ScSpecEntry>>

Implementations§

Source§

impl Spec

Source

pub fn new(entries: &[ScSpecEntry]) -> Self

Source

pub fn from_wasm(wasm: &[u8]) -> Result<Spec, Error>

Source

pub fn parse_base64(base64: &str) -> Result<Spec, Error>

Source§

impl Spec

Source

pub fn doc( &self, name: &str, type_: &ScType, ) -> Result<Option<&'static str>, Error>

§Errors

Could fail to find User Defined Type

Source

pub fn find(&self, name: &str) -> Result<&ScSpecEntry, Error>

§Errors

Might return errors

Source

pub fn find_function(&self, name: &str) -> Result<&ScSpecFunctionV0, Error>

§Errors

Might return errors

Source

pub fn find_functions( &self, ) -> Result<impl Iterator<Item = &ScSpecFunctionV0>, Error>

§Errors
Source

pub fn find_error_type( &self, value: u32, ) -> Result<&ScSpecUdtErrorEnumCaseV0, Error>

§Errors
Source

pub fn from_string_primitive(s: &str, t: &ScType) -> Result<ScVal, Error>

§Errors

Might return errors

Source

pub fn from_string(&self, s: &str, t: &ScType) -> Result<ScVal, Error>

§Errors

Might return errors

Source

pub fn from_json(&self, v: &Value, t: &ScType) -> Result<ScVal, Error>

§Errors

Might return errors

Source§

impl Spec

Source

pub fn xdr_to_json(&self, val: &ScVal, output: &ScType) -> Result<Value, Error>

§Errors

Might return Error::InvalidValue

§Panics

May panic

Source

pub fn vec_m_to_json<const MAX: u32>( &self, vec_m: &VecM<ScVal, MAX>, type_: &ScType, ) -> Result<Value, Error>

§Errors

Might return an error

Source

pub fn sc_map_to_json( &self, sc_map: &ScMap, type_: &ScSpecTypeMap, ) -> Result<Value, Error>

§Errors

Might return an error

Source

pub fn udt_to_json( &self, name: &StringM<60>, sc_obj: &ScVal, ) -> Result<Value, Error>

§Errors

Might return an error

§Panics

May panic

Source

pub fn sc_object_to_json( &self, val: &ScVal, spec_type: &ScType, ) -> Result<Value, Error>

§Errors

Might return an error

§Panics

Some types are not yet supported and will cause a panic if supplied

Source§

impl Spec

Source

pub fn arg_value_name(&self, type_: &ScType, depth: usize) -> Option<String>

Source§

impl Spec

Source

pub fn example(&self, type_: &ScType) -> Option<String>

Trait Implementations§

Source§

impl Clone for Spec

Source§

fn clone(&self) -> Spec

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 Default for Spec

Source§

fn default() -> Spec

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

impl TryInto<Spec> for &[u8]

Source§

type Error = FromWasmError

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

fn try_into(self) -> Result<Spec, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Spec

§

impl RefUnwindSafe for Spec

§

impl Send for Spec

§

impl Sync for Spec

§

impl Unpin for Spec

§

impl UnwindSafe for Spec

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.