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<'n>(self, name: &'n str) -> Result<bool, Error>
pub fn bit_value<'n>(self, name: &'n 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<'n>(self, name: &'n str) -> Result<i64, Error>
pub fn int_value<'n>(self, name: &'n 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<'n>(self, name: &'n str) -> Result<String, Error>
pub fn code_value<'n>(self, name: &'n 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<'n>(self, name: &'n str) -> Result<&'a str, Error>
pub fn code_str_value<'n>(self, name: &'n 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<'n>(self, name: &'n str) -> Result<String, Error>
pub fn string_value<'n>(self, name: &'n 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<'n>(self, name: &'n str) -> Result<&'a str, Error>
pub fn str_value<'n>(self, name: &'n 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