Struct glsl_lang::transpiler::glsl::FormattingState
source · pub struct FormattingState<'s> {
pub settings: &'s FormattingSettings,
indentation_level: u32,
new_line_pending: bool,
in_function_definition_statement: bool,
last_flush_line_flushed_line: bool,
is_first_external_declaration: bool,
}
Expand description
Formatting state of the GLSL transpiler
Fields§
§settings: &'s FormattingSettings
Formatting settings
indentation_level: u32
§new_line_pending: bool
§in_function_definition_statement: bool
§last_flush_line_flushed_line: bool
§is_first_external_declaration: bool
Implementations§
source§impl<'s> FormattingState<'s>
impl<'s> FormattingState<'s>
fn write_indent<F>(&self, f: &mut F) -> Result
fn write_line<F>(&mut self, f: &mut F) -> Result
sourcepub fn consume_newline(&mut self)
pub fn consume_newline(&mut self)
Consume the pending newlines
sourcepub fn flush_line<F>(&mut self, f: &mut F) -> Result
pub fn flush_line<F>(&mut self, f: &mut F) -> Result
Flush pending newlines to the output, if any
sourcepub fn move_to_empty_line<F>(&mut self, f: &mut F) -> Result
pub fn move_to_empty_line<F>(&mut self, f: &mut F) -> Result
Makes sure that the next text to be written to the output will be put at an empty line, or at a line with only indentation characters. Does nothing if the output is already at an empty line
sourcepub fn flush_space<F>(&mut self, f: &mut F) -> Result
pub fn flush_space<F>(&mut self, f: &mut F) -> Result
Flush pending newlines as spaces to the output, if any
sourcepub fn enter_compound_statement_block<F>(&mut self, f: &mut F) -> Result
pub fn enter_compound_statement_block<F>(&mut self, f: &mut F) -> Result
Enter a new compound statement block, and update the indentation level
sourcepub fn enter_external_declaration<F>(&mut self, f: &mut F) -> Result
pub fn enter_external_declaration<F>(&mut self, f: &mut F) -> Result
Enters a new external declaration, flushing pending newlines
sourcepub fn exit_external_declaration(&mut self)
pub fn exit_external_declaration(&mut self)
Exits the current external declaration
sourcepub fn enter_block<F>(&mut self, f: &mut F) -> Result
pub fn enter_block<F>(&mut self, f: &mut F) -> Result
Enter a new block, and update the indentation level
sourcefn enter_block_inner<F>(&mut self, f: &mut F) -> Result
fn enter_block_inner<F>(&mut self, f: &mut F) -> Result
Common logic for entering a new block, and updating the indentation level
sourcepub fn exit_block<F>(&mut self, f: &mut F) -> Result
pub fn exit_block<F>(&mut self, f: &mut F) -> Result
Exit the current block, and update the indentation level
sourcepub fn enter_function_definition_statement(&mut self)
pub fn enter_function_definition_statement(&mut self)
Enter a new function definition statement
sourcepub fn consume_function_definition_statement(&mut self)
pub fn consume_function_definition_statement(&mut self)
Consume the current function definition statement
sourcepub fn enter_collapsed_compound_statement(&mut self) -> Result
pub fn enter_collapsed_compound_statement(&mut self) -> Result
Enter a collapsed compound statement
sourcepub fn exit_collapsed_compound_statement(&mut self) -> Result
pub fn exit_collapsed_compound_statement(&mut self) -> Result
Exit the current collapsed compound statement
sourcepub fn enter_initializer_list<F>(&mut self, f: &mut F) -> Result
pub fn enter_initializer_list<F>(&mut self, f: &mut F) -> Result
Enter a list initializer
sourcepub fn end_initializer_list<F>(&mut self, f: &mut F) -> Result
pub fn end_initializer_list<F>(&mut self, f: &mut F) -> Result
Exit the current list initializer
sourcepub fn enter_case_label<F>(&mut self, f: &mut F) -> Result
pub fn enter_case_label<F>(&mut self, f: &mut F) -> Result
Enter a case label
sourcepub fn write_else<F>(&mut self, f: &mut F) -> Result
pub fn write_else<F>(&mut self, f: &mut F) -> Result
Write a else keyword, part of an if statement
sourcepub fn write_struct_field_separator<F>(&mut self, f: &mut F) -> Result
pub fn write_struct_field_separator<F>(&mut self, f: &mut F) -> Result
Write a struct field separator
sourcepub fn write_list_separator<F>(&mut self, f: &mut F) -> Result
pub fn write_list_separator<F>(&mut self, f: &mut F) -> Result
Write a list separator
sourcepub fn write_for_statement_separator<F>(&mut self, f: &mut F) -> Result
pub fn write_for_statement_separator<F>(&mut self, f: &mut F) -> Result
Write a for statement separator
sourcepub fn write_struct_declaration_terminator<F>(&mut self, f: &mut F) -> Result
pub fn write_struct_declaration_terminator<F>(&mut self, f: &mut F) -> Result
Write a struct declaration terminator
sourcepub fn write_declaration_terminator<F>(&mut self, f: &mut F) -> Result
pub fn write_declaration_terminator<F>(&mut self, f: &mut F) -> Result
Write a declaration terminator
sourcepub fn write_binary_op<F>(&self, f: &mut F, op: &str) -> Result
pub fn write_binary_op<F>(&self, f: &mut F, op: &str) -> Result
Write a binary operator
sourcepub fn write_statement_terminator<F>(&mut self, f: &mut F) -> Result
pub fn write_statement_terminator<F>(&mut self, f: &mut F) -> Result
Write a statement terminator
sourcepub fn write_function_definition_terminator<F>(&mut self, f: &mut F) -> Result
pub fn write_function_definition_terminator<F>(&mut self, f: &mut F) -> Result
Write a function definition terminator
sourcepub fn write_statement_opening_parenthesis<F>(&mut self, f: &mut F) -> Result
pub fn write_statement_opening_parenthesis<F>(&mut self, f: &mut F) -> Result
Write an opening parenthesis for a statement
Trait Implementations§
source§impl<'s> Clone for FormattingState<'s>
impl<'s> Clone for FormattingState<'s>
source§fn clone(&self) -> FormattingState<'s>
fn clone(&self) -> FormattingState<'s>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'s> Debug for FormattingState<'s>
impl<'s> Debug for FormattingState<'s>
source§impl Default for FormattingState<'static>
impl Default for FormattingState<'static>
source§impl<'s> From<&'s FormattingSettings> for FormattingState<'s>
impl<'s> From<&'s FormattingSettings> for FormattingState<'s>
source§fn from(settings: &'s FormattingSettings) -> Self
fn from(settings: &'s FormattingSettings) -> Self
source§impl<'s> PartialEq for FormattingState<'s>
impl<'s> PartialEq for FormattingState<'s>
impl<'s> Copy for FormattingState<'s>
impl<'s> Eq for FormattingState<'s>
impl<'s> StructuralPartialEq for FormattingState<'s>
Auto Trait Implementations§
impl<'s> Freeze for FormattingState<'s>
impl<'s> RefUnwindSafe for FormattingState<'s>
impl<'s> Send for FormattingState<'s>
impl<'s> Sync for FormattingState<'s>
impl<'s> Unpin for FormattingState<'s>
impl<'s> UnwindSafe for FormattingState<'s>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more