[][src]Struct gf::datamodel::Data

pub struct Data<'a> { /* fields omitted */ }

Typed data.

Methods

impl<'a> Data<'a>[src]

pub fn new(ptr: DataPtr<'a>) -> Self[src]

Create empty typed data at ptr.

pub fn ptr(&self) -> &DataPtr<'a>[src]

Return the data pointer.

pub fn len(&self) -> u64[src]

Return data length in bytes.

pub fn pos(&self) -> u64[src]

Return start position in the source.

pub fn pos_range(&self) -> Range<u64>[src]

Return position range in the source.

pub fn ty(&self) -> &'a Ty<'a>[src]

Return data type.

pub fn ty_instance(&self) -> &TyInstance<'a>[src]

Return data type instance.

pub fn endianness(&self) -> Option<Endianness>[src]

Return data endianness.

The returned value is determined using the following rules:

  • if this is raw byte data, return its associated endianness;
  • if this is a structure with exactly one internal field, then return endianness of its data;
  • otherwise, return None.

In effect, this means that endianness is defined only for raw byte data and for any nesting of transparent wrappers around it. For data to be readable as a bit vector through ReadData, this method must return Some.

pub fn get_internal(&self, id: RelationId) -> Option<&Data<'a>>[src]

Get data for an internal relation.

Errors

  • Panics on invalid ID.
  • Panics on a non-internal relation.

pub fn set_internal(&mut self, id: RelationId, data: Data<'a>)[src]

Set data for an internal relation.

Errors

  • Panics on invalid ID.
  • Panics on a non-internal relation.

pub fn get_internal_path<P: AsRef<[RelationId]>>(
    &self,
    path: P
) -> Option<&Data<'a>>
[src]

Get data for an internal relation path.

Errors

  • Panics on invalid ID along the path.
  • Panics on a non-internal relation along the path.

pub fn get_external(&self, id: RelationId) -> Option<&DataPtr<'a>>[src]

Get data pointer for an external relation.

Errors

  • Panics on invalid ID.
  • Panics on a non-external relation.

pub fn set_external(&mut self, id: RelationId, ptr: DataPtr<'a>)[src]

Set data pointer for an external relation.

Errors

  • Panics on invalid ID.
  • Panics on a non-external relation.

Auto Trait Implementations

impl<'a> Send for Data<'a>

impl<'a> Sync for Data<'a>

impl<'a> Unpin for Data<'a>

impl<'a> UnwindSafe for Data<'a>

impl<'a> RefUnwindSafe for Data<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]