Skip to main content

AstTransformationContext

Struct AstTransformationContext 

Source
pub struct AstTransformationContext {
    pub namespace_aliases: RefCell<HashMap<String, String>>,
    /* private fields */
}

Fields§

§namespace_aliases: RefCell<HashMap<String, String>>

Implementations§

Source§

impl AstTransformationContext

Source

pub fn report_diagnostic_at( &self, diagnostic_code: &str, severity: XamlDiagnosticSeverity, title: &str, offender: Option<&dyn IXamlLineInfo>, min_severity: XamlDiagnosticSeverity, ) -> XamlResult<()>

ReportDiagnostic(diagnosticCode, severity, title, offender, minSeverity).

Source

pub fn report_transform_error_node( &self, title: &str, offender: Rc<dyn IXamlAstNode>, ) -> XamlResult<Rc<dyn IXamlAstNode>>

ReportTransformError(title, offender): reports the error and returns the offender.

Source

pub fn report_transform_error<TReturn>( &self, title: &str, offender: Option<&dyn IXamlLineInfo>, ret: TReturn, ) -> XamlResult<TReturn>

ReportTransformError<TReturn>(title, offender, ret).

Source

pub fn report_error<TReturn>( &self, exception: XamlError, ret: TReturn, ) -> XamlResult<TReturn>

ReportError<TReturn>(exception, ret).

Source§

impl AstTransformationContext

Source

pub fn new( configuration: Rc<TransformerConfiguration>, xaml_document: Option<&XamlDocument>, ) -> Self

Source

pub fn document(&self) -> Option<&str>

Source

pub fn current_document(&self) -> Option<String>

The value of the (virtual upstream) Document property: the override installed with AstTransformationContext::set_document_override if there is one, the document the context was created for otherwise. Diagnostics and errors are attributed to it.

Source

pub fn set_document_override(&self, document: Option<Option<String>>)

Stands in for a derived context overriding the Document property: Some(value) makes AstTransformationContext::current_document return value, None removes the override.

Source

pub fn configuration(&self) -> &Rc<TransformerConfiguration>

Source

pub fn root_object(&self) -> XamlResult<Rc<dyn IXamlAstValueNode>>

Source

pub fn set_root_object(&self, value: Rc<dyn IXamlAstValueNode>)

Source

pub fn try_get_namespace_alias(&self, alias: &str) -> Option<String>

NamespaceAliases.TryGetValue.

Source

pub fn report_diagnostic( &self, diagnostic: XamlDiagnostic, throw_on_fatal: bool, ) -> XamlResult<XamlDiagnosticSeverity>

Reports a diagnostic to the configured handler and returns the resulting severity. With throw_on_fatal, a fatal diagnostic is turned into an error.

Source

pub fn visit( &self, root: &Rc<dyn IXamlAstNode>, transformer: &dyn IXamlAstTransformer, ) -> XamlResult<Rc<dyn IXamlAstNode>>

Source

pub fn visit_children( &self, root: &dyn IXamlAstNode, transformer: &dyn IXamlAstTransformer, ) -> XamlResult<()>

Source

pub fn on_unhandled_transform_error(&self, exception: &XamlError) -> bool

Returns true when the error was reported as non-fatal and the transformation may go on.

Methods from Deref<Target = XamlContextBase>§

Source

pub fn get_item<T: 'static>(&self) -> XamlResult<Rc<T>>

Source

pub fn get_or_create_item<T: Default + 'static>(&self) -> Rc<T>

Source

pub fn try_get_item<T: 'static>(&self) -> Option<Rc<T>>

Source

pub fn set_item<T: 'static>(&self, item: Rc<T>)

Source

pub fn parent_nodes(&self) -> Vec<Rc<dyn IXamlAstNode>>

The parents of the current node, innermost first.

Source

pub fn first_parent_node(&self) -> Option<Rc<dyn IXamlAstNode>>

The innermost parent: ParentNodes().FirstOrDefault().

Source

pub fn has_parent_nodes(&self) -> bool

ParentNodes().Any().

Source

pub fn push_parent(&self, node: Rc<dyn IXamlAstNode>)

Source

pub fn pop_parent(&self) -> Option<Rc<dyn IXamlAstNode>>

Trait Implementations§

Source§

impl Deref for AstTransformationContext

Gives access to the XamlContextBase members (the C# base class).

Source§

type Target = XamlContextBase

The resulting type after dereferencing.
Source§

fn deref(&self) -> &XamlContextBase

Dereferences the value.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.