Struct ruschm::interpreter::LibraryLoader[][src]

pub struct LibraryLoader<'a, R: RealNumberInternalTrait> { /* fields omitted */ }

Implementations

impl<'a, R: RealNumberInternalTrait> LibraryLoader<'a, R>[src]

pub fn new() -> Self[src]

pub fn register_library_factory(
    &mut self,
    library_factory: LibraryFactory<'a, R>
)
[src]

pub fn with_lib_factory(self, library_factory: LibraryFactory<'a, R>) -> Self[src]

pub fn iter_library_names(&self) -> impl Iterator<Item = &LibraryName>[src]

iterate all registered library name in library loader

Example

use ruschm::library_name;
use ruschm::interpreter::{LibraryLoader, LibraryFactory};
use ruschm::parser::LibraryName;
use std::collections::HashSet;
let library_loader = LibraryLoader::<f32>::new()
    .with_lib_factory(LibraryFactory::Native(library_name!("foo"), Box::new(|| vec![])))
    .with_lib_factory(LibraryFactory::Native(
        library_name!("foo", "bar"),
        Box::new(|| vec![]),
    ))
    .with_lib_factory(LibraryFactory::Native(library_name!(0, "a"), Box::new(|| vec![])));
assert_eq!(
    library_loader.iter_library_names().collect::<HashSet<_>>(),
    vec![
        &library_name!("foo"),
        &library_name!("foo", "bar"),
        &library_name!(0, "a")
    ]
    .into_iter()
    .collect::<HashSet<_>>()
);

Auto Trait Implementations

impl<'a, R> !RefUnwindSafe for LibraryLoader<'a, R>

impl<'a, R> !Send for LibraryLoader<'a, R>

impl<'a, R> !Sync for LibraryLoader<'a, R>

impl<'a, R> Unpin for LibraryLoader<'a, R>

impl<'a, R> !UnwindSafe for LibraryLoader<'a, R>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.