pub enum IJType {
Void,
Tensor(Option<String>),
Number(Option<String>),
Function(FunctionSignature),
Group(Vec<IJType>),
}
Variants§
Implementations§
Source§impl IJType
impl IJType
pub fn tensor_function(inputs: usize) -> IJType
pub fn number_function(inputs: usize) -> IJType
pub fn tensor_to_number_function(inputs: usize) -> IJType
Sourcepub fn parse_tokens(tokens: &[Token]) -> Result<(Self, usize)>
pub fn parse_tokens(tokens: &[Token]) -> Result<(Self, usize)>
Parses tokens and returns the type and the number of tokens consumed.
pub fn from_string(s: &str) -> Result<Self>
pub fn extract_signature(&self) -> Option<FunctionSignature>
Sourcepub fn extract_number_type(&self) -> Option<Option<String>>
pub fn extract_number_type(&self) -> Option<Option<String>>
Extracts the number type from the type. If the type is not a scalar, tensor, or number, it returns None.
Note that this thus returns an Option<Option
pub fn type_match(&self, other: &Self) -> bool
Sourcepub fn type_match_function(&self, other: &Self) -> Result<bool>
pub fn type_match_function(&self, other: &Self) -> Result<bool>
Checks if the function type matches the other function type. For example an `Fn(S->S) matches a Fn(S->S).
pub fn type_downcast_number_type(&self, other: &Self) -> Result<Self>
pub fn maybe_apply_number_type(&self, other: &Option<String>) -> Self
Trait Implementations§
impl StructuralPartialEq for IJType
Auto Trait Implementations§
impl Freeze for IJType
impl RefUnwindSafe for IJType
impl Send for IJType
impl Sync for IJType
impl Unpin for IJType
impl UnwindSafe for IJType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more