pub struct Ir {
pub format_version: FormatVersion,
pub modules: Vec<Module>,
}Expand description
A complete IR file: a format version and the modules of one target build.
Fields§
§format_version: FormatVersionThe IR format version.
modules: Vec<Module>The modules of the build.
Implementations§
Source§impl Ir
impl Ir
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
pub fn validate(&self) -> Result<(), ValidationErrors>
Checks every module’s type references and type-table invariants.
Parsing doesn’t run this. It reports every problem and leaves it to the caller to decide which are fatal.
§Errors
ValidationErrors listing every problem, if there are any.
Source§impl Ir
impl Ir
Sourcepub fn from_json_slice(bytes: &[u8]) -> Result<Self>
pub fn from_json_slice(bytes: &[u8]) -> Result<Self>
Parses IR from JSON bytes.
The version is read first, so a file of another major version fails
with Error::UnsupportedVersion instead of a structural error.
§Errors
Error::UnsupportedVersionif the major version isn’tSUPPORTED_MAJOR.Error::Jsonif the bytes aren’t valid IR JSON.
Sourcepub fn from_json_str(text: &str) -> Result<Self>
pub fn from_json_str(text: &str) -> Result<Self>
Sourcepub fn to_json_pretty(&self) -> Result<String>
pub fn to_json_pretty(&self) -> Result<String>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Ir
impl<'de> Deserialize<'de> for Ir
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for Ir
impl JsonSchema for Ir
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl StructuralPartialEq for Ir
Auto Trait Implementations§
impl Freeze for Ir
impl RefUnwindSafe for Ir
impl Send for Ir
impl Sync for Ir
impl Unpin for Ir
impl UnsafeUnpin for Ir
impl UnwindSafe for Ir
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