pub struct Composite {
pub type_path: String,
pub inners: Vec<CompositeInner>,
pub generic_args: Vec<(String, Token)>,
pub type: CompositeType,
pub is_event: bool,
pub alias: Option<String>,
}Fields§
§type_path: String§inners: Vec<CompositeInner>§generic_args: Vec<(String, Token)>§type: CompositeType§is_event: bool§alias: Option<String>Implementations§
Source§impl Composite
impl Composite
Sourcepub fn parse(type_path: &str) -> CainomeResult<Self>
pub fn parse(type_path: &str) -> CainomeResult<Self>
Parses a composite type from a type path. Since the composite can be named arbitrarily, by the user, the parsing of the composite is not checking if the type path is a core basic type, an array or something else.
In cainome the type path is first parsed as any other token, and
Composite is the last token that is parsed (which accepts every path).
You may use Composite::is_builtin to check if the type path is
a known Cairo builtin type.
§Arguments
type_path- The type path to parse.
§Returns
Returns a Composite token if the type path is a composite.
Returns an error otherwise.
pub fn type_path_no_generic(&self) -> String
pub fn is_generic(&self) -> bool
Sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
Returns true if the current composite is considered as Cairo builtin.
This is useful to avoid expanding the structure if already managed by
the backend (like Option and Result for instance).
Spans and Arrays are handled by array.