ShaderModuleParser

Struct ShaderModuleParser 

Source
pub struct ShaderModuleParser { /* private fields */ }

Implementations§

Source§

impl ShaderModuleParser

Source

pub fn glsl() -> Self

Source

pub fn hlsl() -> Self

Source

pub fn wgsl() -> Self

Source

pub fn from_shading_language(shading_language: ShadingLanguage) -> Self

Examples found in repository?
examples/main.rs (line 31)
29fn query_all_symbol<T: ShadingLanguageTag>(shader_path: &Path, shader_content: &str) {
30    // SymbolProvider intended to gather file symbol at runtime by inspecting the AST.
31    let mut shader_module_parser = ShaderModuleParser::from_shading_language(T::get_language());
32    let symbol_provider = SymbolProvider::from_shading_language(T::get_language());
33    match shader_module_parser.create_module(shader_path, shader_content) {
34        Ok(shader_module) => {
35            let symbols = symbol_provider
36                .query_symbols(
37                    &shader_module,
38                    ShaderParams::default(),
39                    &mut default_include_callback::<T>,
40                    None,
41                )
42                .unwrap();
43            let symbol_list = symbols.get_all_symbols();
44            println!("Found symbols: {:#?}", symbol_list);
45        }
46        Err(err) => println!("Failed to create ast: {:#?}", err),
47    }
48}
Source

pub fn create_module( &mut self, file_path: &Path, shader_content: &str, ) -> Result<ShaderModule, ShaderError>

Examples found in repository?
examples/main.rs (line 33)
29fn query_all_symbol<T: ShadingLanguageTag>(shader_path: &Path, shader_content: &str) {
30    // SymbolProvider intended to gather file symbol at runtime by inspecting the AST.
31    let mut shader_module_parser = ShaderModuleParser::from_shading_language(T::get_language());
32    let symbol_provider = SymbolProvider::from_shading_language(T::get_language());
33    match shader_module_parser.create_module(shader_path, shader_content) {
34        Ok(shader_module) => {
35            let symbols = symbol_provider
36                .query_symbols(
37                    &shader_module,
38                    ShaderParams::default(),
39                    &mut default_include_callback::<T>,
40                    None,
41                )
42                .unwrap();
43            let symbol_list = symbols.get_all_symbols();
44            println!("Found symbols: {:#?}", symbol_list);
45        }
46        Err(err) => println!("Failed to create ast: {:#?}", err),
47    }
48}
Source

pub fn update_module( &mut self, module: &mut ShaderModule, new_text: &String, ) -> Result<(), ShaderError>

Source

pub fn update_module_partial( &mut self, module: &mut ShaderModule, old_range: &ShaderRange, new_text: &String, ) -> Result<(), ShaderError>

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.