pub struct DynLanguageModel(/* private fields */);Expand description
Type-erased language model handle.
Newtype over Arc<dyn LanguageModel> so the API does not leak a smart
pointer (see M-AVOID-WRAPPERS). Cheap to clone; implements
LanguageModel by delegation so callers can use it directly.
Implementations§
Source§impl DynLanguageModel
impl DynLanguageModel
Sourcepub fn new<M: LanguageModel + 'static>(model: M) -> Self
pub fn new<M: LanguageModel + 'static>(model: M) -> Self
Wrap a concrete model implementation.
Sourcepub fn from_arc(model: Arc<dyn LanguageModel>) -> Self
pub fn from_arc(model: Arc<dyn LanguageModel>) -> Self
Wrap an already-shared Arc.
Sourcepub fn into_inner(self) -> Arc<dyn LanguageModel> ⓘ
pub fn into_inner(self) -> Arc<dyn LanguageModel> ⓘ
Consume the wrapper and return the underlying Arc.
Trait Implementations§
Source§impl Clone for DynLanguageModel
impl Clone for DynLanguageModel
Source§fn clone(&self) -> DynLanguageModel
fn clone(&self) -> DynLanguageModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DynLanguageModel
impl Debug for DynLanguageModel
Auto Trait Implementations§
impl Freeze for DynLanguageModel
impl !RefUnwindSafe for DynLanguageModel
impl Send for DynLanguageModel
impl Sync for DynLanguageModel
impl Unpin for DynLanguageModel
impl UnsafeUnpin for DynLanguageModel
impl !UnwindSafe for DynLanguageModel
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