Skip to main content

DefaultFactory

Struct DefaultFactory 

Source
pub struct DefaultFactory;
Expand description

The built-in Factory: scalars, core collections, and class stubs.

Trait Implementations§

Source§

impl Default for DefaultFactory

Source§

fn default() -> DefaultFactory

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

impl Factory for DefaultFactory

Source§

fn opaque(&self, value: Arc<dyn RuntimeObject>) -> Result<Value>

Wraps an arbitrary runtime object as an opaque value.
Source§

fn class_stub(&self, id: ClassId, symbol: Symbol) -> Result<Value>

Builds a class value from a class id and symbol.
Source§

fn nil(&self) -> Result<Value>

Builds the nil value.
Source§

fn bool(&self, value: bool) -> Result<Value>

Builds a boolean value.
Source§

fn symbol(&self, value: Symbol) -> Result<Value>

Builds a symbol value.
Source§

fn string(&self, value: String) -> Result<Value>

Builds a string value.
Source§

fn bytes(&self, value: Vec<u8>) -> Result<Value>

Builds a byte-string value.
Source§

fn list(&self, items: Vec<Value>) -> Result<Value>

Builds a list value from its items.
Source§

fn table(&self, entries: Vec<(Symbol, Value)>) -> Result<Value>

Builds a table value from its entries.
Source§

fn expr(&self, expr: Expr) -> Result<Value>

Builds a value carrying an Expr.
Source§

fn number_literal(&self, domain: Symbol, canonical: String) -> Result<Value>

Builds a number value from a domain symbol and canonical text.
Source§

fn table_one(&self, key: Symbol, value: Value) -> Result<Value>

Builds a single-entry table; convenience over table.

Auto Trait Implementations§

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> 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, 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.