dprint_core::formatting

Struct ConditionResolverContext

source
pub struct ConditionResolverContext<'a, 'b> {
    pub writer_info: WriterInfo,
    /* private fields */
}
Expand description

Context used when resolving a condition.

Fields§

§writer_info: WriterInfo

Gets the writer info at the condition’s location.

Implementations§

source§

impl<'a, 'b> ConditionResolverContext<'a, 'b>

source

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.

source

pub fn resolved_line_and_column( &mut self, line_and_column: LineAndColumn, ) -> Option<(u32, u32)>

Gets a resolved line and column.

source

pub fn resolved_line_number(&mut self, line_number: LineNumber) -> Option<u32>

Gets the line number or returns None when not yet resolved.

source

pub fn resolved_column_number( &mut self, column_number: ColumnNumber, ) -> Option<u32>

Gets the column number or returns None when not yet resolved.

source

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.

source

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.

source

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.

source

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.

source

pub fn clear_line_and_column(&mut self, lc: LineAndColumn)

Clears the line and column from being stored.

source

pub fn clear_info(&mut self, info: impl Into<Info>)

Clears the info from being stored.

source

pub fn is_forcing_no_newlines(&self) -> bool

Gets if the printer is currently forcing no newlines.

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for ConditionResolverContext<'a, 'b>

§

impl<'a, 'b> !RefUnwindSafe for ConditionResolverContext<'a, 'b>

§

impl<'a, 'b> !Send for ConditionResolverContext<'a, 'b>

§

impl<'a, 'b> !Sync for ConditionResolverContext<'a, 'b>

§

impl<'a, 'b> Unpin for ConditionResolverContext<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for ConditionResolverContext<'a, 'b>

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.