Struct oso::ClassBuilder [−][src]
pub struct ClassBuilder<T> { /* fields omitted */ }
Implementations
impl<T> ClassBuilder<T> where
T: 'static,
[src]
impl<T> ClassBuilder<T> where
T: 'static,
[src]pub fn with_default() -> Self where
T: Default,
T: Send + Sync,
[src]
pub fn with_default() -> Self where
T: Default,
T: Send + Sync,
[src]Create a new class builder for a type that implements Default and use that as the constructor.
pub fn with_constructor<F, Args>(f: F) -> Self where
F: Function<Args, Result = T>,
T: Send + Sync,
Args: FromPolarList,
[src]
pub fn with_constructor<F, Args>(f: F) -> Self where
F: Function<Args, Result = T>,
T: Send + Sync,
Args: FromPolarList,
[src]Create a new class builder with a given constructor.
pub fn set_constructor<F, Args>(self, f: F) -> Self where
F: Function<Args, Result = T>,
T: Send + Sync,
Args: FromPolarList,
[src]
pub fn set_constructor<F, Args>(self, f: F) -> Self where
F: Function<Args, Result = T>,
T: Send + Sync,
Args: FromPolarList,
[src]Set the constructor function to use for polar new
statements.
pub fn set_equality_check<F>(self, f: F) -> Self where
F: Fn(&T, &T) -> bool + Send + Sync + 'static,
[src]
pub fn set_equality_check<F>(self, f: F) -> Self where
F: Fn(&T, &T) -> bool + Send + Sync + 'static,
[src]Set an equality function to be used for polar ==
statements.
pub fn set_into_iter<F, I, V>(self, f: F) -> Self where
F: Fn(&T) -> I + Send + Sync + 'static,
I: Iterator<Item = V> + Clone + Send + Sync + 'static,
V: ToPolarResult,
[src]
pub fn set_into_iter<F, I, V>(self, f: F) -> Self where
F: Fn(&T) -> I + Send + Sync + 'static,
I: Iterator<Item = V> + Clone + Send + Sync + 'static,
V: ToPolarResult,
[src]Set a method to convert instances into iterators
pub fn with_iter<V>(self) -> Self where
T: IntoIterator<Item = V> + Clone,
<T as IntoIterator>::IntoIter: Clone + Send + Sync + 'static,
V: ToPolarResult,
[src]
pub fn with_iter<V>(self) -> Self where
T: IntoIterator<Item = V> + Clone,
<T as IntoIterator>::IntoIter: Clone + Send + Sync + 'static,
V: ToPolarResult,
[src]Use the existing IntoIterator
implementation to convert instances into iterators
pub fn with_equality_check(self) -> Self where
T: PartialEq<T>,
[src]
pub fn with_equality_check(self) -> Self where
T: PartialEq<T>,
[src]Use PartialEq::eq as the equality check for polar ==
statements.
pub fn add_attribute_getter<F, R>(self, name: &'static str, f: F) -> Self where
F: Fn(&T) -> R + Send + Sync + 'static,
R: ToPolar,
T: 'static,
[src]
pub fn add_attribute_getter<F, R>(self, name: &'static str, f: F) -> Self where
F: Fn(&T) -> R + Send + Sync + 'static,
R: ToPolar,
T: 'static,
[src]Add an attribute getter for statments like foo.bar
`class.add_attribute_getter(“bar”, |instance| instance.bar)
pub fn add_constant<V: ToPolar + Clone + Send + Sync + 'static>(
self,
value: V,
name: &'static str
) -> Self
[src]
pub fn add_constant<V: ToPolar + Clone + Send + Sync + 'static>(
self,
value: V,
name: &'static str
) -> Self
[src]Add a RegisterHook on the class that will register the given constant once the class is registered.
pub fn add_method<F, Args, R>(self, name: &'static str, f: F) -> Self where
Args: FromPolarList,
F: Method<T, Args, Result = R>,
R: ToPolarResult + 'static,
[src]
pub fn add_method<F, Args, R>(self, name: &'static str, f: F) -> Self where
Args: FromPolarList,
F: Method<T, Args, Result = R>,
R: ToPolarResult + 'static,
[src]Add a method for polar method calls like foo.plus(1)
class.add_attribute_getter(“bar”, |instance, n| instance.foo + n)
pub fn add_iterator_method<F, Args, I>(self, name: &'static str, f: F) -> Self where
Args: FromPolarList,
F: Method<T, Args>,
F::Result: IntoIterator<Item = I>,
I: ToPolarResult + 'static,
<<F as Method<T, Args>>::Result as IntoIterator>::IntoIter: Iterator<Item = I> + Clone + Send + Sync + 'static,
T: 'static,
[src]
pub fn add_iterator_method<F, Args, I>(self, name: &'static str, f: F) -> Self where
Args: FromPolarList,
F: Method<T, Args>,
F::Result: IntoIterator<Item = I>,
I: ToPolarResult + 'static,
<<F as Method<T, Args>>::Result as IntoIterator>::IntoIter: Iterator<Item = I> + Clone + Send + Sync + 'static,
T: 'static,
[src]A method that returns multiple values. Every element in the iterator returned by the method will be a separate polar return value.
pub fn add_class_method<F, Args, R>(self, name: &'static str, f: F) -> Self where
F: Function<Args, Result = R>,
Args: FromPolarList,
R: ToPolarResult + 'static,
[src]
pub fn add_class_method<F, Args, R>(self, name: &'static str, f: F) -> Self where
F: Function<Args, Result = R>,
Args: FromPolarList,
R: ToPolarResult + 'static,
[src]A method that’s called on the type instead of an instance.
eg Foo.pi
Trait Implementations
impl<T: Clone> Clone for ClassBuilder<T>
[src]
impl<T: Clone> Clone for ClassBuilder<T>
[src]fn clone(&self) -> ClassBuilder<T>
[src]
fn clone(&self) -> ClassBuilder<T>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for ClassBuilder<T>
impl<T> Send for ClassBuilder<T> where
T: Send,
T: Send,
impl<T> Sync for ClassBuilder<T> where
T: Sync,
T: Sync,
impl<T> Unpin for ClassBuilder<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for ClassBuilder<T>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more