pub struct Registry { /* private fields */ }Expand description
Everything of the host program an interpreted program can reach.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn function(
&mut self,
ty: &str,
name: &str,
f: impl Fn(Vec<Value>) -> Result<Value, String> + 'static,
)
pub fn function( &mut self, ty: &str, name: &str, f: impl Fn(Vec<Value>) -> Result<Value, String> + 'static, )
Type::name(..), taking the arguments as they are.
Sourcepub fn method(
&mut self,
ty: &str,
name: &str,
f: impl Fn(Vec<Value>) -> Result<Value, String> + 'static,
)
pub fn method( &mut self, ty: &str, name: &str, f: impl Fn(Vec<Value>) -> Result<Value, String> + 'static, )
value.name(..) on a host value of ty; the receiver comes first.
Sourcepub fn method_for<T: 'static>(
&mut self,
ty: &str,
name: &str,
f: impl Fn(Vec<Value>) -> Result<Value, String> + 'static,
)
pub fn method_for<T: 'static>( &mut self, ty: &str, name: &str, f: impl Fn(Vec<Value>) -> Result<Value, String> + 'static, )
value.name(..) on a host value holding a T, for types that share a name, such as
the forms of a generic component.
Sourcepub fn constant(
&mut self,
ty: &str,
name: &str,
make: impl Fn() -> Value + 'static,
)
pub fn constant( &mut self, ty: &str, name: &str, make: impl Fn() -> Value + 'static, )
Type::NAME, made each time it is read.
Sourcepub fn free_function(
&mut self,
name: &str,
f: impl Fn(Vec<Value>) -> Result<Value, String> + 'static,
)
pub fn free_function( &mut self, name: &str, f: impl Fn(Vec<Value>) -> Result<Value, String> + 'static, )
A function called by its name alone, such as a helper the samples share.
Sourcepub fn field(
&mut self,
ty: &str,
name: &str,
get: impl Fn(&Value) -> Result<Value, String> + 'static,
)
pub fn field( &mut self, ty: &str, name: &str, get: impl Fn(&Value) -> Result<Value, String> + 'static, )
How value.name reads a field of a host struct of ty.
Sourcepub fn set_field(
&mut self,
ty: &str,
name: &str,
set: impl Fn(&Value, Value) -> Result<(), String> + 'static,
)
pub fn set_field( &mut self, ty: &str, name: &str, set: impl Fn(&Value, Value) -> Result<(), String> + 'static, )
How value.name = .. changes a field of a host struct of ty.
Sourcepub fn record(
&mut self,
ty: &str,
build: impl Fn(Vec<(String, Value)>, Option<Value>) -> Result<Value, String> + 'static,
)
pub fn record( &mut self, ty: &str, build: impl Fn(Vec<(String, Value)>, Option<Value>) -> Result<Value, String> + 'static, )
How Ty { a: .., b: .., ..base } builds a host struct.
Sourcepub fn name_type<T: 'static>(&mut self, name: &'static str)
pub fn name_type<T: 'static>(&mut self, name: &'static str)
Remembers which name a Rust type goes by, for conversions.
Sourcepub fn conversion<From: 'static, To: 'static>(
&mut self,
name: &'static str,
convert: fn(From) -> To,
)
pub fn conversion<From: 'static, To: 'static>( &mut self, name: &'static str, convert: fn(From) -> To, )
How a host value of type From becomes a To when a function asks for a To, as a
Button becomes an AnyView.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Registry
impl !Send for Registry
impl !Sync for Registry
impl !UnwindSafe for Registry
impl Freeze for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
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