pub struct Record<'a> { /* private fields */ }
Expand description
An immutable reference to a TableGen record.
This reference cannot outlive the
RecordKeeper
from which it is
borrowed.
Implementations§
Source§impl<'a> Record<'a>
impl<'a> Record<'a>
Sourcepub unsafe fn from_raw(ptr: TableGenRecordRef) -> Record<'a>
pub unsafe fn from_raw(ptr: TableGenRecordRef) -> Record<'a>
Sourcepub fn bit_value(self, name: &str) -> Result<bool, Error>
pub fn bit_value(self, name: &str) -> Result<bool, Error>
Returns the boolean value of the field with the given name if this
field is of type BitInit
.
Sourcepub fn int_value(self, name: &str) -> Result<i64, Error>
pub fn int_value(self, name: &str) -> Result<i64, Error>
Returns the integer value of the field with the given name if this
field is of type IntInit
.
Sourcepub fn code_value(self, name: &str) -> Result<String, Error>
pub fn code_value(self, name: &str) -> Result<String, Error>
Returns the field with the given name converted to a String
if this field is of type StringInit
.
Note that this copies the string into a new string.
Sourcepub fn code_str_value(self, name: &str) -> Result<&'a str, Error>
pub fn code_str_value(self, name: &str) -> Result<&'a str, Error>
Returns the field with the given name converted to a &str
if this field is of type StringInit
.
Sourcepub fn string_value(self, name: &str) -> Result<String, Error>
pub fn string_value(self, name: &str) -> Result<String, Error>
Returns the field with the given name converted to a String
if this field is of type StringInit
.
Note that this copies the string into a new string.
Sourcepub fn str_value(self, name: &str) -> Result<&'a str, Error>
pub fn str_value(self, name: &str) -> Result<&'a str, Error>
Returns the field with the given name converted to a &str
if this field is of type StringInit
.
Sourcepub fn value<'n>(self, name: &'n str) -> Result<RecordValue<'a>, Error>
pub fn value<'n>(self, name: &'n str) -> Result<RecordValue<'a>, Error>
Returns a RecordValue
for the field with the given name.
Sourcepub fn subclass_of(self, class: &str) -> bool
pub fn subclass_of(self, class: &str) -> bool
Returns true if the record is a subclass of the class with the given name.
Sourcepub fn values(self) -> RecordValueIter<'a> ⓘ
pub fn values(self) -> RecordValueIter<'a> ⓘ
Returns an iterator over the fields of the record.
The iterator yields RecordValue
structs