pub struct ConditionResolverContext<'a, 'b> {
pub writer_info: WriterInfo,
/* private fields */
}Expand description
Context used when resolving a condition.
Fields§
§writer_info: WriterInfoGets the writer info at the condition’s location.
Implementations§
Source§impl<'a, 'b> ConditionResolverContext<'a, 'b>
impl<'a, 'b> ConditionResolverContext<'a, 'b>
Sourcepub fn resolved_condition(
&mut self,
condition_reference: &ConditionReference,
) -> Option<bool>
pub fn resolved_condition( &mut self, condition_reference: &ConditionReference, ) -> Option<bool>
Gets if a condition was true, false, or returns None when not yet resolved.
A condition reference can be retrieved by calling the create_reference() on a condition.
Sourcepub fn resolved_line_and_column(
&mut self,
line_and_column: LineAndColumn,
) -> Option<(u32, u32)>
pub fn resolved_line_and_column( &mut self, line_and_column: LineAndColumn, ) -> Option<(u32, u32)>
Gets a resolved line and column.
Sourcepub fn resolved_line_number(&mut self, line_number: LineNumber) -> Option<u32>
pub fn resolved_line_number(&mut self, line_number: LineNumber) -> Option<u32>
Gets the line number or returns None when not yet resolved.
Sourcepub fn resolved_column_number(
&mut self,
column_number: ColumnNumber,
) -> Option<u32>
pub fn resolved_column_number( &mut self, column_number: ColumnNumber, ) -> Option<u32>
Gets the column number or returns None when not yet resolved.
Sourcepub fn resolved_is_start_of_line(
&mut self,
is_start_of_line: IsStartOfLine,
) -> Option<bool>
pub fn resolved_is_start_of_line( &mut self, is_start_of_line: IsStartOfLine, ) -> Option<bool>
Gets if the info is at the start of the line or returns None when not yet resolved.
Sourcepub fn resolved_indent_level(&mut self, indent_level: IndentLevel) -> Option<u8>
pub fn resolved_indent_level(&mut self, indent_level: IndentLevel) -> Option<u8>
Gets if the indent level at this info or returns None when not yet resolved.
Sourcepub fn resolved_line_start_column_number(
&mut self,
line_start_column_number: LineStartColumnNumber,
) -> Option<u32>
pub fn resolved_line_start_column_number( &mut self, line_start_column_number: LineStartColumnNumber, ) -> Option<u32>
Gets the column number at the start of the line this info appears or returns None when not yet resolved.
Sourcepub fn resolved_line_start_indent_level(
&mut self,
line_start_indent_level: LineStartIndentLevel,
) -> Option<u8>
pub fn resolved_line_start_indent_level( &mut self, line_start_indent_level: LineStartIndentLevel, ) -> Option<u8>
Gets the indent level at the start of the line this info appears or returns None when not yet resolved.
Sourcepub fn clear_line_and_column(&mut self, lc: LineAndColumn)
pub fn clear_line_and_column(&mut self, lc: LineAndColumn)
Clears the line and column from being stored.
Sourcepub fn clear_info(&mut self, info: impl Into<Info>)
pub fn clear_info(&mut self, info: impl Into<Info>)
Clears the info from being stored.
Sourcepub fn shift_line_number(&mut self, info: LineNumber, delta: isize)
pub fn shift_line_number(&mut self, info: LineNumber, delta: isize)
Moves an already resolved line number by delta lines.
Use this instead of clearing when the text the line number refers to has only moved up or down the page, so that it stays correct relative to everything around it.
Sourcepub fn without_looking_ahead<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T
pub fn without_looking_ahead<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T
Runs f without the printer going back to this condition once the infos and conditions
it gets that aren’t resolved yet are resolved.
This is for a condition that’s re-evaluated after them (see Condition::create_reevaluation),
which only goes back when its value changes, so it can assume a value until then.
Sourcepub fn peek_line_number(&self, line_number: LineNumber) -> Option<u32>
pub fn peek_line_number(&self, line_number: LineNumber) -> Option<u32>
Gets the line number when it’s resolved, without looking ahead to it when it isn’t.
Sourcepub fn set_line_number(&mut self, line_number: LineNumber, value: u32)
pub fn set_line_number(&mut self, line_number: LineNumber, value: u32)
Sets the line number to a value that was worked out before (ex. when the text it refers to is printed at the same position again).
Sourcepub fn is_forcing_no_newlines(&self) -> bool
pub fn is_forcing_no_newlines(&self) -> bool
Gets if the printer is currently forcing no newlines.