pub struct DispatchTable {
pub name: String,
pub methods: Vec<JuliaFunction>,
}Expand description
A dispatch table for multiple dispatch — groups method variants of a function.
Fields§
§name: StringFunction name shared by all methods
methods: Vec<JuliaFunction>Method specializations, ordered by specificity (most specific first)
Implementations§
Source§impl DispatchTable
impl DispatchTable
Sourcepub fn add_method(&mut self, method: JuliaFunction)
pub fn add_method(&mut self, method: JuliaFunction)
Add a method specialization.
Sourcepub fn num_methods(&self) -> usize
pub fn num_methods(&self) -> usize
Return the number of registered methods.
Sourcepub fn find_method(&self, arg_types: &[JuliaType]) -> Option<&JuliaFunction>
pub fn find_method(&self, arg_types: &[JuliaType]) -> Option<&JuliaFunction>
Find the most specific applicable method for given argument types. This is a simplified linear scan (real Julia does lattice-based dispatch).
Trait Implementations§
Source§impl Clone for DispatchTable
impl Clone for DispatchTable
Source§fn clone(&self) -> DispatchTable
fn clone(&self) -> DispatchTable
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DispatchTable
impl RefUnwindSafe for DispatchTable
impl Send for DispatchTable
impl Sync for DispatchTable
impl Unpin for DispatchTable
impl UnsafeUnpin for DispatchTable
impl UnwindSafe for DispatchTable
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