[][src]Struct gf::datamodel::StructBuilder

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

Builder for a structure type.

Methods

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

pub fn new() -> Self[src]

Start building a structure.

pub fn finish(self) -> Result<Ty<'a>, TyError>[src]

Finish building the structure.

pub unsafe fn finish_unchecked(self) -> Ty<'a>[src]

Finish building the structure without linting.

pub fn add_arg(&mut self, arg: TyArg) -> TyArgId[src]

Add a type argument to the structure and return its assigned ID.

pub fn next_arg_id(&self) -> TyArgId[src]

Return the ID that will be assigned to the next type argument.

pub fn add_relation(&mut self, relation: Relation<'a>) -> RelationId[src]

Add a relation to the structure and return its assigned ID.

pub fn next_relation_id(&self) -> RelationId[src]

Return the ID that will be assigned to the next relation.

pub fn add_field(
    &mut self,
    name: &str,
    ty_instance_ctor: TyInstanceCtor<'a>
) -> RelationId
[src]

Add a field to the structure.

This is a convenience wrapper around relation. The added relation is an internal relation, its location is set to what next_field_location returns. The next field location is updated to point just after the new field.

pub fn next_field_location(&self) -> &Location[src]

Return location of next field.

If no fields have been added, the location is the beginning of the structure. Otherwise, it points just after the end of the last added field.

Auto Trait Implementations

impl<'a> Send for StructBuilder<'a>

impl<'a> Sync for StructBuilder<'a>

impl<'a> Unpin for StructBuilder<'a>

impl<'a> UnwindSafe for StructBuilder<'a>

impl<'a> RefUnwindSafe for StructBuilder<'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]