Struct calyx_ir::LibrarySignatures
source · [−]pub struct LibrarySignatures { /* private fields */ }
Expand description
A representation of all the primitive definitions found while parsing the root program.
Implementations
sourceimpl LibrarySignatures
impl LibrarySignatures
sourcepub fn add_inline_primitive(
&mut self,
primitive: Primitive
) -> &mut PrimitiveInfo
pub fn add_inline_primitive(
&mut self,
primitive: Primitive
) -> &mut PrimitiveInfo
Add a new inline primitive to the context. Panics if a primitive with the same name is already defined.
sourcepub fn add_extern_primitive(&mut self, file: PathBuf, primitive: Primitive)
pub fn add_extern_primitive(&mut self, file: PathBuf, primitive: Primitive)
Add a new, non-inline primitive to the context. Panics if a primitive with the same name is already defined. Requires that the file path is absolute and canonical.
sourcepub fn find_primitive<S>(&self, name: S) -> Option<&Primitive>where
S: Into<Id>,
pub fn find_primitive<S>(&self, name: S) -> Option<&Primitive>where
S: Into<Id>,
Return the Primitive associated with the given name if defined, otherwise return None.
sourcepub fn get_primitive<S>(&self, name: S) -> &Primitivewhere
S: Into<Id>,
pub fn get_primitive<S>(&self, name: S) -> &Primitivewhere
S: Into<Id>,
Return the Primitive associated to this Id.
sourcepub fn mark_inline_source(&mut self, name: Id)
pub fn mark_inline_source(&mut self, name: Id)
Mark an inlined primitive as a part of the source. This is useful when using file mode compilation and printing only the source primitives. Panics if the primitive is not defined.
sourcepub fn mark_extern_source(&mut self, path: PathBuf)
pub fn mark_extern_source(&mut self, path: PathBuf)
Marks an import
ed extern block as a part of the source.
There is no way to mark an individual primitive as a part of the source since the entire file will be linked.
Panics if the file path is not defined
sourcepub fn signatures(&self) -> impl Iterator<Item = &Primitive>
pub fn signatures(&self) -> impl Iterator<Item = &Primitive>
Return an iterator over all defined primitives.
sourcepub fn prim_infos(&self) -> &Vec<PrimitiveInfo, Global>
pub fn prim_infos(&self) -> &Vec<PrimitiveInfo, Global>
Returns all the underlying primitive information. If you want all the signatures, use LibrarySignatures::signatures instead.
sourcepub fn prim_inlines(&self) -> impl Iterator<Item = (&Primitive, bool)>
pub fn prim_inlines(&self) -> impl Iterator<Item = (&Primitive, bool)>
Return the underyling inlined primitives and whether they are source defined
sourcepub fn extern_paths(&self) -> Vec<&PathBuf, Global>
pub fn extern_paths(&self) -> Vec<&PathBuf, Global>
Return the paths for the extern defining files along with whether they are source defined.