ShaderSymbols

Struct ShaderSymbols 

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

Implementations§

Source§

impl ShaderSymbols

Source

pub fn new(file_path: &Path, shader_params: ShaderContextParams) -> Self

Source

pub fn get_all_symbols<'a>(&'a self) -> ShaderSymbolListRef<'a>

Examples found in repository?
examples/main.rs (line 43)
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 get_local_symbols<'a>(&'a self) -> ShaderSymbolListRef<'a>

Source

pub fn get_context(&self) -> &ShaderPreprocessorContext

Source

pub fn get_preprocessor(&self) -> &ShaderPreprocessor

Source

pub fn get_preprocessor_mut(&mut self) -> &mut ShaderPreprocessor

Source

pub fn visit_includes<F: FnMut(&ShaderPreprocessorInclude)>( &self, callback: &mut F, )

Source

pub fn visit_includes_mut<F: FnMut(&mut ShaderPreprocessorInclude)>( &mut self, callback: &mut F, )

Source

pub fn find_include_stack<F: FnMut(&ShaderPreprocessorInclude) -> bool>( &self, callback: &mut F, ) -> Option<Vec<&ShaderPreprocessorInclude>>

Source

pub fn find_include<F: FnMut(&ShaderPreprocessorInclude) -> bool>( &self, callback: &mut F, ) -> Option<&ShaderPreprocessorInclude>

Source

pub fn find_direct_includer( &self, include_path: &Path, ) -> Option<&ShaderPreprocessorInclude>

Source

pub fn has_dependency(&self, dependency_to_find_path: &Path) -> bool

Source

pub fn dump_dependency_tree(&self, absolute_path: &PathBuf) -> String

Trait Implementations§

Source§

impl Clone for ShaderSymbols

Source§

fn clone(&self) -> ShaderSymbols

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ShaderSymbols

Source§

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

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

impl Default for ShaderSymbols

Source§

fn default() -> ShaderSymbols

Returns the “default value” for a type. Read more

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> 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.