ImplBlock

Struct ImplBlock 

Source
pub struct ImplBlock { /* private fields */ }
Expand description

An impl block.

Implementations§

Source§

impl ImplBlock

For Trait

Source

pub fn for_trait(&self) -> Option<&RustType>

Gets the optional for trait.

Source

pub fn set_for_trait<T>(&mut self, for_trait: T)
where T: Into<RustType>,

Sets the for_trait.

Source

pub fn with_for_trait<T>(self, for_trait: T) -> Self
where T: Into<RustType>,

Sets the for_trait.

Source§

impl ImplBlock

Constants

Source

pub fn constants(&self) -> &[ConstInit]

Gets the constants.

Source

pub fn add_constant(&mut self, constant: ConstInit)

Adds the constant.

Source

pub fn with_constant(self, constant: ConstInit) -> Self

Adds the constant.

Source

pub fn write_constants(&self, b: &mut CodeBuffer, level: usize)

Adds the constant.

Trait Implementations§

Source§

impl<T: Into<RustType>> From<T> for ImplBlock

Source§

fn from(base: T) -> Self

Converts to this type from the input type.
Source§

impl IsEmpty for ImplBlock

Source§

fn is_empty(&self) -> bool

Checks if the element is empty.
Source§

impl Statement for ImplBlock

Source§

fn write(&self, b: &mut CodeBuffer, level: usize)

Writes the code to the buffer b at the indent level.
Source§

impl WithComments for ImplBlock

Source§

fn comments(&self) -> &[String]

Gets the comment lines.
Source§

fn add_comment<S>(&mut self, comment: S)
where S: Into<String>,

Adds the comment line.
Source§

fn with_comment<S>(self, comment: S) -> Self
where S: Into<String>,

Adds the comment line.
Source§

fn write_comments( &self, comment_type: CommentType, b: &mut CodeBuffer, level: usize, )

Writes the comment lines.
Source§

impl WithFunctions for ImplBlock

Source§

fn functions(&self) -> &[Function]

Gets the functions.
Source§

fn add_function<F>(&mut self, function: F)
where F: Into<Function>,

Adds the function.
Source§

fn with_function<F>(self, function: F) -> Self
where F: Into<Function>,

Adds the function.
Source§

fn write_functions(&self, b: &mut CodeBuffer, level: usize)

Writes the functions.
Source§

impl WithGenerics for ImplBlock

Source§

fn generics(&self) -> &[Var]

Gets the generic type parameters.
Source§

fn add_generic<V>(&mut self, generic: V)
where V: Into<Var>,

Adds the generic type parameter.
Source§

fn with_generic<V>(self, generic: V) -> Self
where V: Into<Var>,

Adds the generic type parameter.
Source§

fn write_generic_brackets(&self, b: &mut CodeBuffer)

Writes the generic brackets. (ex: <A: TypeA, B: TypeB>)
Source§

impl WithRustType for ImplBlock

Source§

fn rust_type(&self) -> &RustType

Gets the Rust type.
Source§

fn write_rust_type(&self, b: &mut CodeBuffer)

Writes the Rust type.
Source§

impl WithTypeDecs for ImplBlock

Source§

fn type_decs(&self) -> &[TypeDec]

Gets the type decs.
Source§

fn add_type_dec<D>(&mut self, type_dec: D)
where D: Into<TypeDec>,

Adds the type_dec.
Source§

fn with_type_dec<D>(self, type_dec: D) -> Self
where D: Into<TypeDec>,

Adds the type_dec.
Source§

fn write_type_decs(&self, b: &mut CodeBuffer, level: usize)

Writes the type declarations.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.