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
Trait Implementations§
source§impl SourceLoc for Record<'_>
impl SourceLoc for Record<'_>
source§fn source_location(self) -> SourceLocation
fn source_location(self) -> SourceLocation
source§impl<'a> TryFrom<RecordValue<'a>> for Record<'a>
impl<'a> TryFrom<RecordValue<'a>> for Record<'a>
source§type Error = SourceError<TableGenError>
type Error = SourceError<TableGenError>
impl<'a> Copy for Record<'a>
impl<'a> Eq for Record<'a>
impl<'a> StructuralPartialEq for Record<'a>
Auto Trait Implementations§
impl<'a> Freeze for Record<'a>
impl<'a> RefUnwindSafe for Record<'a>
impl<'a> !Send for Record<'a>
impl<'a> !Sync for Record<'a>
impl<'a> Unpin for Record<'a>
impl<'a> UnwindSafe for Record<'a>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)