Extension

Struct Extension 

Source
pub struct Extension<Buffer: IoWrite> {
    pub name: String,
    pub kind: ExtensionKind<Buffer>,
}
Expand description

§Diatom rust extension

Each extension has a name, which is used to identify extension when being imported. For example, import my_ext.sub_ext will automatically look up base extension my_ext and its sub extension sub_ext.

Fields§

§name: String

§Name of this extension

§Note:

  • Sub extensions with the same name will OVERRIDE each other.
  • If name is not a valid diatom identifier this extension can NOT be imported.
  • Name must not contain /, otherwise will be ignore this extension.
  • If the name is mod then the extension will be load when parent module is imported. (The same way <module>/mod.dm works)

§For base extension

Base extensions are the extension that directly registered to the interpreter. Their names must be unique (will otherwise rejected by the interpreter). Also, base extension names will hijack ANY import starts with its name. For example, an extension with name my_ext will cause all import my_ext.<anything here> to be resolved to the extension. This will make local file like my_ext.dm inaccessible.

§kind: ExtensionKind<Buffer>

The kind of this extension

Trait Implementations§

Source§

impl<Buffer: IoWrite> Debug for Extension<Buffer>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Buffer> Freeze for Extension<Buffer>

§

impl<Buffer> !RefUnwindSafe for Extension<Buffer>

§

impl<Buffer> Send for Extension<Buffer>

§

impl<Buffer> Sync for Extension<Buffer>

§

impl<Buffer> Unpin for Extension<Buffer>

§

impl<Buffer> !UnwindSafe for Extension<Buffer>

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.