TagResolver

Struct TagResolver 

Source
pub struct TagResolver {
    directives: HashMap<String, String>,
    handlers: HashMap<String, Box<dyn TagHandler>>,
    schema: Schema,
}
Expand description

Tag resolution context

Fields§

§directives: HashMap<String, String>

Tag directives (handle -> prefix)

§handlers: HashMap<String, Box<dyn TagHandler>>

Custom tag handlers

§schema: Schema

Default schema

Implementations§

Source§

impl TagResolver

Source

pub fn new() -> Self

Create a new tag resolver with default schema

Source

pub fn with_schema(schema: Schema) -> Self

Create a new tag resolver with specific schema

Source

pub fn add_directive(&mut self, handle: String, prefix: String)

Add a tag directive

Source

pub fn clear_directives(&mut self)

Clear all tag directives

Source

pub fn register_handler( &mut self, tag_uri: String, handler: Box<dyn TagHandler>, )

Register a custom tag handler

Source

pub fn resolve(&self, tag_str: &str) -> Result<Tag>

Resolve a tag string to a full Tag

Source

fn identify_tag_kind(uri: &str) -> TagKind

Identify the kind of tag from its URI

Source

pub fn apply_tag(&self, tag: &Tag, value: &str) -> Result<Value>

Apply a tag to a value

Source

fn construct_bool(&self, value: &str) -> Result<Value>

Construct a boolean from a tagged value

Source

fn construct_int(&self, value: &str) -> Result<Value>

Construct an integer from a tagged value

Source

fn construct_float(&self, value: &str) -> Result<Value>

Construct a float from a tagged value

Source

fn construct_binary(&self, value: &str) -> Result<Value>

Construct binary data from a tagged value (base64)

Source

fn construct_timestamp(&self, value: &str) -> Result<Value>

Construct a timestamp from a tagged value

Trait Implementations§

Source§

impl Debug for TagResolver

Source§

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

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

impl Default for TagResolver

Source§

fn default() -> Self

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