Skip to main content

Node

Struct Node 

Source
pub struct Node<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Node<'a>

Source

pub fn root() -> Node<'a>

Source

pub fn root_with_children(children: Vec<Node<'a>>) -> Node<'a>

Source

pub fn scope(name: &'a str, children: Vec<Node<'a>>) -> Node<'a>

Source

pub fn struct(name: &'a str, fields: Vec<Node<'a>>) -> Node<'a>

Source

pub fn member(name: &'a str, type: &str) -> Node<'a>

Source

pub fn member_expression(name: impl Into<Cow<'a, str>>) -> Node<'a>

Source

pub fn function( name: &'a str, params: Vec<Node<'a>>, return_type: &'a str, statements: Vec<Node<'a>>, ) -> Node<'a>

Source

pub fn conditional(condition: Node<'a>, statements: Vec<Node<'a>>) -> Node<'a>

Source

pub fn for_loop( initializer: Node<'a>, condition: Node<'a>, update: Node<'a>, statements: Vec<Node<'a>>, ) -> Node<'a>

Source

pub fn main_function(statements: Vec<Node<'a>>) -> Node<'a>

Source

pub fn binding( name: &'a str, type: Node<'a>, slot: u32, read: bool, write: bool, ) -> Node<'a>

Source

pub fn binding_array( name: &'a str, type: Node<'a>, slot: u32, read: bool, write: bool, count: u32, ) -> Node<'a>

Source

pub fn specialization(name: &'a str, type: &'a str) -> Node<'a>

Source

pub fn buffer(name: &'a str, members: Vec<Node<'a>>) -> Node<'a>

Source

pub fn image(format: &'a str) -> Node<'a>

Source

pub fn push_constant(members: Vec<Node<'a>>) -> Node<'a>

Source

pub fn combined_image_sampler() -> Node<'a>

Source

pub fn combined_array_image_sampler() -> Node<'a>

Source

pub fn macro(name: &'a str, body: Node<'a>) -> Node<'a>

Source

pub fn sentence(expressions: Vec<Node<'a>>) -> Node<'a>

Source

pub fn expression(elements: Vec<Node<'a>>) -> Node<'a>

Source

pub fn accessor(left: Node<'a>, right: Node<'a>) -> Node<'a>

Source

pub fn call(name: &'a str, parameters: Vec<Node<'a>>) -> Node<'a>

Source

pub fn operator(name: &'a str, left: Node<'a>, right: Node<'a>) -> Node<'a>

Source

pub fn assignment(left: Node<'a>, right: Node<'a>) -> Node<'a>

Source

pub fn variable_declaration(name: &'a str, type: &'a str) -> Node<'a>

Source

pub fn literal_expression(value: impl Into<Cow<'a, str>>) -> Node<'a>

Source

pub fn return_value(value: Node<'a>) -> Node<'a>

Source

pub fn return_void() -> Node<'a>

Source

pub fn let_assignment(name: &'a str, type: &'a str, value: Node<'a>) -> Node<'a>

Source

pub fn member_assignment(name: &'a str, value: Node<'a>) -> Node<'a>

Source

pub fn glsl( code: impl Into<Cow<'a, str>>, input: &'a [&'a str], output: &'a [&'a str], ) -> Node<'a>

Source

pub fn hlsl( code: impl Into<Cow<'a, str>>, input: &'a [&'a str], output: &'a [&'a str], ) -> Node<'a>

Source

pub fn msl( code: impl Into<Cow<'a, str>>, input: &'a [&'a str], output: &'a [&'a str], ) -> Node<'a>

Source

pub fn raw_code( glsl: Option<Cow<'a, str>>, hlsl: Option<Cow<'a, str>>, msl: Option<Cow<'a, str>>, input: &'a [&'a str], output: &'a [&'a str], ) -> Node<'a>

Builds parser raw code with explicit backend sources and interface names.

Source

pub fn literal(name: &'a str, body: Node<'a>) -> Node<'a>

Source

pub fn input(name: &'a str, format: &'a str, location: u8) -> Node<'a>

Source

pub fn output(name: &'a str, format: &'a str, location: u8) -> Node<'a>

Source

pub fn output_array( name: &'a str, format: &'a str, location: u8, count: u32, ) -> Node<'a>

Source

pub fn task_payload(name: &'a str, format: &'a str, count: u32) -> Node<'a>

Source

pub fn workgroup(name: &'a str, format: &'a str) -> Node<'a>

Source

pub fn intrinsic( name: &'a str, parameters: Node<'a>, body: Node<'a>, return: &'a str, ) -> Node<'a>

Source

pub fn null() -> Node<'a>

Source

pub fn parameter(name: &'a str, type: &'a str) -> Node<'a>

Source

pub fn constant(name: &'a str, type: &'a str, value: Node<'a>) -> Node<'a>

Source

pub fn name(&self) -> Option<&'a str>

Source

pub fn node_mut(&mut self) -> &mut Nodes<'a>

Source

pub fn node(&self) -> &Nodes<'a>

Source

pub fn get_mut(&mut self, name: &str) -> Option<&mut Node<'a>>

Source

pub fn add(&mut self, children: Vec<Node<'a>>)

Trait Implementations§

Source§

impl<'a> Clone for Node<'a>

Source§

fn clone(&self) -> Node<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Node<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Index<&str> for Node<'a>

Source§

type Output = Node<'a>

The returned type after indexing.
Source§

fn index(&self, index: &str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Node<'a>

§

impl<'a> RefUnwindSafe for Node<'a>

§

impl<'a> Send for Node<'a>

§

impl<'a> Sync for Node<'a>

§

impl<'a> Unpin for Node<'a>

§

impl<'a> UnsafeUnpin for Node<'a>

§

impl<'a> UnwindSafe for Node<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.