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
modthen the extension will be load when parent module is imported. (The same way<module>/mod.dmworks)
§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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more