PluginCommand

Enum PluginCommand 

Source
pub enum PluginCommand {
Show 80 variants InsertText { buffer_id: BufferId, position: usize, text: String, }, DeleteRange { buffer_id: BufferId, range: Range<usize>, }, AddOverlay { buffer_id: BufferId, namespace: Option<OverlayNamespace>, range: Range<usize>, color: (u8, u8, u8), bg_color: Option<(u8, u8, u8)>, underline: bool, bold: bool, italic: bool, extend_to_line_end: bool, }, RemoveOverlay { buffer_id: BufferId, handle: OverlayHandle, }, SetStatus { message: String, }, ApplyTheme { theme_name: String, }, ReloadConfig, RegisterCommand { command: Command, }, UnregisterCommand { name: String, }, OpenFileInBackground { path: PathBuf, }, InsertAtCursor { text: String, }, SpawnProcess { command: String, args: Vec<String>, cwd: Option<String>, callback_id: JsCallbackId, }, Delay { callback_id: JsCallbackId, duration_ms: u64, }, SpawnBackgroundProcess { process_id: u64, command: String, args: Vec<String>, cwd: Option<String>, callback_id: JsCallbackId, }, KillBackgroundProcess { process_id: u64, }, SpawnProcessWait { process_id: u64, callback_id: JsCallbackId, }, SetLayoutHints { buffer_id: BufferId, split_id: Option<SplitId>, range: Range<usize>, hints: LayoutHints, }, SetLineNumbers { buffer_id: BufferId, enabled: bool, }, SubmitViewTransform { buffer_id: BufferId, split_id: Option<SplitId>, payload: ViewTransformPayload, }, ClearViewTransform { buffer_id: BufferId, split_id: Option<SplitId>, }, ClearAllOverlays { buffer_id: BufferId, }, ClearNamespace { buffer_id: BufferId, namespace: OverlayNamespace, }, ClearOverlaysInRange { buffer_id: BufferId, start: usize, end: usize, }, AddVirtualText { buffer_id: BufferId, virtual_text_id: String, position: usize, text: String, color: (u8, u8, u8), use_bg: bool, before: bool, }, RemoveVirtualText { buffer_id: BufferId, virtual_text_id: String, }, RemoveVirtualTextsByPrefix { buffer_id: BufferId, prefix: String, }, ClearVirtualTexts { buffer_id: BufferId, }, AddVirtualLine { buffer_id: BufferId, position: usize, text: String, fg_color: (u8, u8, u8), bg_color: Option<(u8, u8, u8)>, above: bool, namespace: String, priority: i32, }, ClearVirtualTextNamespace { buffer_id: BufferId, namespace: String, }, RefreshLines { buffer_id: BufferId, }, SetLineIndicator { buffer_id: BufferId, line: usize, namespace: String, symbol: String, color: (u8, u8, u8), priority: i32, }, ClearLineIndicators { buffer_id: BufferId, namespace: String, }, SetFileExplorerDecorations { namespace: String, decorations: Vec<FileExplorerDecoration>, }, ClearFileExplorerDecorations { namespace: String, }, OpenFileAtLocation { path: PathBuf, line: Option<usize>, column: Option<usize>, }, OpenFileInSplit { split_id: usize, path: PathBuf, line: Option<usize>, column: Option<usize>, }, StartPrompt { label: String, prompt_type: String, }, StartPromptWithInitial { label: String, prompt_type: String, initial_value: String, }, StartPromptAsync { label: String, initial_value: String, callback_id: JsCallbackId, }, SetPromptSuggestions { suggestions: Vec<Suggestion>, }, AddMenuItem { menu_label: String, item: MenuItem, position: MenuPosition, }, AddMenu { menu: Menu, position: MenuPosition, }, RemoveMenuItem { menu_label: String, item_label: String, }, RemoveMenu { menu_label: String, }, CreateVirtualBuffer { name: String, mode: String, read_only: bool, }, CreateVirtualBufferWithContent { name: String, mode: String, read_only: bool, entries: Vec<TextPropertyEntry>, show_line_numbers: bool, show_cursors: bool, editing_disabled: bool, hidden_from_tabs: bool, request_id: Option<u64>, }, CreateVirtualBufferInSplit { name: String, mode: String, read_only: bool, entries: Vec<TextPropertyEntry>, ratio: f32, direction: Option<String>, panel_id: Option<String>, show_line_numbers: bool, show_cursors: bool, editing_disabled: bool, line_wrap: Option<bool>, request_id: Option<u64>, }, SetVirtualBufferContent { buffer_id: BufferId, entries: Vec<TextPropertyEntry>, }, GetTextPropertiesAtCursor { buffer_id: BufferId, }, DefineMode { name: String, parent: Option<String>, bindings: Vec<(String, String)>, read_only: bool, }, ShowBuffer { buffer_id: BufferId, }, CreateVirtualBufferInExistingSplit { name: String, mode: String, read_only: bool, entries: Vec<TextPropertyEntry>, split_id: SplitId, show_line_numbers: bool, show_cursors: bool, editing_disabled: bool, line_wrap: Option<bool>, request_id: Option<u64>, }, CloseBuffer { buffer_id: BufferId, }, CreateCompositeBuffer { name: String, mode: String, layout: CompositeLayoutConfig, sources: Vec<CompositeSourceConfig>, hunks: Option<Vec<CompositeHunk>>, request_id: Option<u64>, }, UpdateCompositeAlignment { buffer_id: BufferId, hunks: Vec<CompositeHunk>, }, CloseCompositeBuffer { buffer_id: BufferId, }, FocusSplit { split_id: SplitId, }, SetSplitBuffer { split_id: SplitId, buffer_id: BufferId, }, SetSplitScroll { split_id: SplitId, top_byte: usize, }, RequestHighlights { buffer_id: BufferId, range: Range<usize>, request_id: u64, }, CloseSplit { split_id: SplitId, }, SetSplitRatio { split_id: SplitId, ratio: f32, }, DistributeSplitsEvenly { split_ids: Vec<SplitId>, }, SetBufferCursor { buffer_id: BufferId, position: usize, }, SendLspRequest { language: String, method: String, params: Option<Value>, request_id: u64, }, SetClipboard { text: String, }, DeleteSelection, SetContext { name: String, active: bool, }, SetReviewDiffHunks { hunks: Vec<ReviewHunk>, }, ExecuteAction { action_name: String, }, ExecuteActions { actions: Vec<ActionSpec>, }, GetBufferText { buffer_id: BufferId, start: usize, end: usize, request_id: u64, }, GetLineStartPosition { buffer_id: BufferId, line: u32, request_id: u64, }, SetEditorMode { mode: Option<String>, }, ShowActionPopup { popup_id: String, title: String, message: String, actions: Vec<ActionPopupAction>, }, DisableLspForLanguage { language: String, }, CreateScrollSyncGroup { group_id: u32, left_split: SplitId, right_split: SplitId, }, SetScrollSyncAnchors { group_id: u32, anchors: Vec<(usize, usize)>, }, RemoveScrollSyncGroup { group_id: u32, }, SaveBufferToPath { buffer_id: BufferId, path: PathBuf, },
}
Expand description

Plugin command - allows plugins to send commands to the editor

Variants§

§

InsertText

Insert text at a position in a buffer

Fields

§buffer_id: BufferId
§position: usize
§text: String
§

DeleteRange

Delete a range of text from a buffer

Fields

§buffer_id: BufferId
§range: Range<usize>
§

AddOverlay

Add an overlay to a buffer, returns handle via response channel

Fields

§buffer_id: BufferId
§range: Range<usize>
§color: (u8, u8, u8)
§bg_color: Option<(u8, u8, u8)>
§underline: bool
§bold: bool
§italic: bool
§extend_to_line_end: bool
§

RemoveOverlay

Remove an overlay by its opaque handle

Fields

§buffer_id: BufferId
§

SetStatus

Set status message

Fields

§message: String
§

ApplyTheme

Apply a theme by name

Fields

§theme_name: String
§

ReloadConfig

Reload configuration from file After a plugin saves config changes, it should call this to reload the config

§

RegisterCommand

Register a custom command

Fields

§command: Command
§

UnregisterCommand

Unregister a command by name

Fields

§name: String
§

OpenFileInBackground

Open a file in the editor (in background, without switching focus)

Fields

§path: PathBuf
§

InsertAtCursor

Insert text at the current cursor position in the active buffer

Fields

§text: String
§

SpawnProcess

Spawn an async process

Fields

§command: String
§args: Vec<String>
§callback_id: JsCallbackId
§

Delay

Delay/sleep for a duration (async, resolves callback when done)

Fields

§callback_id: JsCallbackId
§duration_ms: u64
§

SpawnBackgroundProcess

Spawn a long-running background process Unlike SpawnProcess, this returns immediately with a process handle and provides streaming output via hooks

Fields

§process_id: u64

Unique ID for this process (generated by plugin runtime)

§command: String

Command to execute

§args: Vec<String>

Arguments to pass

§cwd: Option<String>

Working directory (optional)

§callback_id: JsCallbackId

Callback ID to call when process exits

§

KillBackgroundProcess

Kill a background process by ID

Fields

§process_id: u64
§

SpawnProcessWait

Wait for a process to complete and get its result Used with processes started via SpawnProcess

Fields

§process_id: u64

Process ID to wait for

§callback_id: JsCallbackId

Callback ID for async response

§

SetLayoutHints

Set layout hints for a buffer/viewport

Fields

§buffer_id: BufferId
§split_id: Option<SplitId>
§range: Range<usize>
§

SetLineNumbers

Enable/disable line numbers for a buffer

Fields

§buffer_id: BufferId
§enabled: bool
§

SubmitViewTransform

Submit a transformed view stream for a viewport

Fields

§buffer_id: BufferId
§split_id: Option<SplitId>
§

ClearViewTransform

Clear view transform for a buffer/split (returns to normal rendering)

Fields

§buffer_id: BufferId
§split_id: Option<SplitId>
§

ClearAllOverlays

Remove all overlays from a buffer

Fields

§buffer_id: BufferId
§

ClearNamespace

Remove all overlays in a namespace

Fields

§buffer_id: BufferId
§

ClearOverlaysInRange

Remove all overlays that overlap with a byte range Used for targeted invalidation when content in a range changes

Fields

§buffer_id: BufferId
§start: usize
§end: usize
§

AddVirtualText

Add virtual text (inline text that doesn’t exist in the buffer) Used for color swatches, type hints, parameter hints, etc.

Fields

§buffer_id: BufferId
§virtual_text_id: String
§position: usize
§text: String
§color: (u8, u8, u8)
§use_bg: bool
§before: bool
§

RemoveVirtualText

Remove a virtual text by ID

Fields

§buffer_id: BufferId
§virtual_text_id: String
§

RemoveVirtualTextsByPrefix

Remove virtual texts whose ID starts with the given prefix

Fields

§buffer_id: BufferId
§prefix: String
§

ClearVirtualTexts

Clear all virtual texts from a buffer

Fields

§buffer_id: BufferId
§

AddVirtualLine

Add a virtual LINE (full line above/below a position) Used for git blame headers, code coverage, inline documentation, etc. These lines do NOT show line numbers in the gutter.

Fields

§buffer_id: BufferId
§position: usize

Byte position to anchor the line to

§text: String

Full line content to display

§fg_color: (u8, u8, u8)

Foreground color (RGB)

§bg_color: Option<(u8, u8, u8)>

Background color (RGB), None = transparent

§above: bool

true = above the line containing position, false = below

§namespace: String

Namespace for bulk removal (e.g., “git-blame”)

§priority: i32

Priority for ordering multiple lines at same position (higher = later)

§

ClearVirtualTextNamespace

Clear all virtual texts in a namespace This is the primary way to remove a plugin’s virtual lines before updating them.

Fields

§buffer_id: BufferId
§namespace: String
§

RefreshLines

Refresh lines for a buffer (clear seen_lines cache to re-trigger lines_changed hook)

Fields

§buffer_id: BufferId
§

SetLineIndicator

Set a line indicator in the gutter’s indicator column Used for git gutter, breakpoints, bookmarks, etc.

Fields

§buffer_id: BufferId
§line: usize

Line number (0-indexed)

§namespace: String

Namespace for grouping (e.g., “git-gutter”, “breakpoints”)

§symbol: String

Symbol to display (e.g., “│”, “●”, “★”)

§color: (u8, u8, u8)

Color as RGB tuple

§priority: i32

Priority for display when multiple indicators exist (higher wins)

§

ClearLineIndicators

Clear all line indicators for a specific namespace

Fields

§buffer_id: BufferId
§namespace: String

Namespace to clear (e.g., “git-gutter”)

§

SetFileExplorerDecorations

Set file explorer decorations for a namespace

Fields

§namespace: String

Namespace for grouping (e.g., “git-status”)

§decorations: Vec<FileExplorerDecoration>

Decorations to apply

§

ClearFileExplorerDecorations

Clear file explorer decorations for a namespace

Fields

§namespace: String

Namespace to clear (e.g., “git-status”)

§

OpenFileAtLocation

Open a file at a specific line and column Line and column are 1-indexed to match git grep output

Fields

§path: PathBuf
§column: Option<usize>
§

OpenFileInSplit

Open a file in a specific split at a given line and column Line and column are 1-indexed to match git grep output

Fields

§split_id: usize
§path: PathBuf
§column: Option<usize>
§

StartPrompt

Start a prompt (minibuffer) with a custom type identifier This allows plugins to create interactive prompts

Fields

§label: String
§prompt_type: String
§

StartPromptWithInitial

Start a prompt with pre-filled initial value

Fields

§label: String
§prompt_type: String
§initial_value: String
§

StartPromptAsync

Start an async prompt that returns result via callback The callback_id is used to resolve the promise when the prompt is confirmed or cancelled

Fields

§label: String
§initial_value: String
§callback_id: JsCallbackId
§

SetPromptSuggestions

Update the suggestions list for the current prompt Uses the editor’s Suggestion type

Fields

§suggestions: Vec<Suggestion>
§

AddMenuItem

Add a menu item to an existing menu Add a menu item to an existing menu

Fields

§menu_label: String
§position: MenuPosition
§

AddMenu

Add a new top-level menu

Fields

§menu: Menu
§position: MenuPosition
§

RemoveMenuItem

Remove a menu item from a menu

Fields

§menu_label: String
§item_label: String
§

RemoveMenu

Remove a top-level menu

Fields

§menu_label: String
§

CreateVirtualBuffer

Create a new virtual buffer (not backed by a file)

Fields

§name: String

Display name (e.g., “Diagnostics”)

§mode: String

Mode name for buffer-local keybindings (e.g., “diagnostics-list”)

§read_only: bool

Whether the buffer is read-only

§

CreateVirtualBufferWithContent

Create a virtual buffer and set its content in one operation This is preferred over CreateVirtualBuffer + SetVirtualBufferContent because it doesn’t require tracking the buffer ID

Fields

§name: String

Display name (e.g., “Diagnostics”)

§mode: String

Mode name for buffer-local keybindings (e.g., “diagnostics-list”)

§read_only: bool

Whether the buffer is read-only

§entries: Vec<TextPropertyEntry>

Entries with text and embedded properties

§show_line_numbers: bool

Whether to show line numbers in the gutter

§show_cursors: bool

Whether to show cursors in the buffer

§editing_disabled: bool

Whether editing is disabled (blocks editing commands)

§hidden_from_tabs: bool

Whether this buffer should be hidden from tabs (for composite source buffers)

§request_id: Option<u64>

Optional request ID for async response

§

CreateVirtualBufferInSplit

Create a virtual buffer in a horizontal split Opens the buffer in a new pane below the current one

Fields

§name: String

Display name (e.g., “Diagnostics”)

§mode: String

Mode name for buffer-local keybindings (e.g., “diagnostics-list”)

§read_only: bool

Whether the buffer is read-only

§entries: Vec<TextPropertyEntry>

Entries with text and embedded properties

§ratio: f32

Split ratio (0.0 to 1.0, where 0.5 = equal split)

§direction: Option<String>

Split direction (“horizontal” or “vertical”), default horizontal

§panel_id: Option<String>

Optional panel ID for idempotent operations (if panel exists, update content)

§show_line_numbers: bool

Whether to show line numbers in the buffer (default true)

§show_cursors: bool

Whether to show cursors in the buffer (default true)

§editing_disabled: bool

Whether editing is disabled for this buffer (default false)

§line_wrap: Option<bool>

Whether line wrapping is enabled for this split (None = use global setting)

§request_id: Option<u64>

Optional request ID for async response (if set, editor will send back buffer ID)

§

SetVirtualBufferContent

Set the content of a virtual buffer with text properties

Fields

§buffer_id: BufferId
§entries: Vec<TextPropertyEntry>

Entries with text and embedded properties

§

GetTextPropertiesAtCursor

Get text properties at the cursor position in a buffer

Fields

§buffer_id: BufferId
§

DefineMode

Define a buffer mode with keybindings

Fields

§name: String
§parent: Option<String>
§bindings: Vec<(String, String)>
§read_only: bool
§

ShowBuffer

Switch the current split to display a buffer

Fields

§buffer_id: BufferId
§

CreateVirtualBufferInExistingSplit

Create a virtual buffer in an existing split (replaces current buffer in that split)

Fields

§name: String

Display name (e.g., “Commit Details”)

§mode: String

Mode name for buffer-local keybindings

§read_only: bool

Whether the buffer is read-only

§entries: Vec<TextPropertyEntry>

Entries with text and embedded properties

§split_id: SplitId

Target split ID where the buffer should be displayed

§show_line_numbers: bool

Whether to show line numbers in the buffer (default true)

§show_cursors: bool

Whether to show cursors in the buffer (default true)

§editing_disabled: bool

Whether editing is disabled for this buffer (default false)

§line_wrap: Option<bool>

Whether line wrapping is enabled for this split (None = use global setting)

§request_id: Option<u64>

Optional request ID for async response

§

CloseBuffer

Close a buffer and remove it from all splits

Fields

§buffer_id: BufferId
§

CreateCompositeBuffer

Create a composite buffer that displays multiple source buffers Used for side-by-side diff, unified diff, and 3-way merge views

Fields

§name: String

Display name (shown in tab bar)

§mode: String

Mode name for keybindings (e.g., “diff-view”)

§layout: CompositeLayoutConfig

Layout configuration

§sources: Vec<CompositeSourceConfig>

Source pane configurations

§hunks: Option<Vec<CompositeHunk>>

Diff hunks for line alignment (optional)

§request_id: Option<u64>

Request ID for async response

§

UpdateCompositeAlignment

Update alignment for a composite buffer (e.g., after source edit)

Fields

§buffer_id: BufferId
§

CloseCompositeBuffer

Close a composite buffer

Fields

§buffer_id: BufferId
§

FocusSplit

Focus a specific split

Fields

§split_id: SplitId
§

SetSplitBuffer

Set the buffer displayed in a specific split

Fields

§split_id: SplitId
§buffer_id: BufferId
§

SetSplitScroll

Set the scroll position of a specific split

Fields

§split_id: SplitId
§top_byte: usize
§

RequestHighlights

Request syntax highlights for a buffer range

Fields

§buffer_id: BufferId
§range: Range<usize>
§request_id: u64
§

CloseSplit

Close a split (if not the last one)

Fields

§split_id: SplitId
§

SetSplitRatio

Set the ratio of a split container

Fields

§split_id: SplitId
§ratio: f32

Ratio between 0.0 and 1.0 (0.5 = equal split)

§

DistributeSplitsEvenly

Distribute splits evenly - make all given splits equal size

Fields

§split_ids: Vec<SplitId>

Split IDs to distribute evenly

§

SetBufferCursor

Set cursor position in a buffer (also scrolls viewport to show cursor)

Fields

§buffer_id: BufferId
§position: usize

Byte offset position for the cursor

§

SendLspRequest

Send an arbitrary LSP request and return the raw JSON response

Fields

§language: String
§method: String
§params: Option<Value>
§request_id: u64
§

SetClipboard

Set the internal clipboard content

Fields

§text: String
§

DeleteSelection

Delete the current selection in the active buffer This deletes all selected text across all cursors

§

SetContext

Set or unset a custom context Custom contexts are plugin-defined states that can be used to control command visibility For example, “config-editor” context could make config editor commands available

Fields

§name: String

Context name (e.g., “config-editor”)

§active: bool

Whether the context is active

§

SetReviewDiffHunks

Set the hunks for the Review Diff tool

Fields

§

ExecuteAction

Execute an editor action by name (e.g., “move_word_right”, “delete_line”) Used by vi mode plugin to run motions and calculate cursor ranges

Fields

§action_name: String

Action name (e.g., “move_word_right”, “move_line_end”)

§

ExecuteActions

Execute multiple actions in sequence, each with an optional repeat count Used by vi mode for count prefix (e.g., “3dw” = delete 3 words) All actions execute atomically with no plugin roundtrips between them

Fields

§actions: Vec<ActionSpec>

List of actions to execute in sequence

§

GetBufferText

Get text from a buffer range (for yank operations)

Fields

§buffer_id: BufferId

Buffer ID

§start: usize

Start byte offset

§end: usize

End byte offset

§request_id: u64

Request ID for async response

§

GetLineStartPosition

Get byte offset of the start of a line (async) Line is 0-indexed (0 = first line)

Fields

§buffer_id: BufferId

Buffer ID (0 for active buffer)

§line: u32

Line number (0-indexed)

§request_id: u64

Request ID for async response

§

SetEditorMode

Set the global editor mode (for modal editing like vi mode) When set, the mode’s keybindings take precedence over normal editing

Fields

§mode: Option<String>

Mode name (e.g., “vi-normal”, “vi-insert”) or None to clear

§

ShowActionPopup

Show an action popup with buttons for user interaction When the user selects an action, the ActionPopupResult hook is fired

Fields

§popup_id: String

Unique identifier for the popup (used in ActionPopupResult)

§title: String

Title text for the popup

§message: String

Body message (supports basic formatting)

§actions: Vec<ActionPopupAction>

Action buttons to display

§

DisableLspForLanguage

Disable LSP for a specific language and persist to config

Fields

§language: String

The language to disable LSP for (e.g., “python”, “rust”)

§

CreateScrollSyncGroup

Create a scroll sync group for anchor-based synchronized scrolling Used for side-by-side diff views where two panes need to scroll together The plugin provides the group ID (must be unique per plugin)

Fields

§group_id: u32

Plugin-assigned group ID

§left_split: SplitId

The left (primary) split - scroll position is tracked in this split’s line space

§right_split: SplitId

The right (secondary) split - position is derived from anchors

§

SetScrollSyncAnchors

Set sync anchors for a scroll sync group Anchors map corresponding line numbers between left and right buffers

Fields

§group_id: u32

The group ID returned by CreateScrollSyncGroup

§anchors: Vec<(usize, usize)>

List of (left_line, right_line) pairs marking corresponding positions

§

RemoveScrollSyncGroup

Remove a scroll sync group

Fields

§group_id: u32

The group ID returned by CreateScrollSyncGroup

§

SaveBufferToPath

Save a buffer to a specific file path Used by :w filename command to save unnamed buffers or save-as

Fields

§buffer_id: BufferId

Buffer ID to save

§path: PathBuf

Path to save to

Trait Implementations§

Source§

impl Clone for PluginCommand

Source§

fn clone(&self) -> PluginCommand

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PluginCommand

Source§

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

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

impl<'de> Deserialize<'de> for PluginCommand

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PluginCommand

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TS for PluginCommand

Source§

type WithoutGenerics = PluginCommand

If this type does not have generic parameters, then WithoutGenerics should just be Self. If the type does have generic parameters, then all generic parameters must be replaced with a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that EXPORT_TO must be None. Read more
Source§

type OptionInnerType = PluginCommand

If the implementing type is std::option::Option<T>, then this associated type is set to T. All other implementations of TS should set this type to Self instead.
Source§

fn ident() -> String

Identifier of this type, excluding generic parameters.
Source§

fn docs() -> Option<String>

JSDoc comment to describe this type in TypeScript - when TS is derived, docs are automatically read from your doc comments or #[doc = ".."] attributes
Source§

fn name() -> String

Name of this type in TypeScript, including generic parameters
Source§

fn decl_concrete() -> String

Declaration of this type using the supplied generic arguments. The resulting TypeScript definition will not be generic. For that, see TS::decl(). If this type is not generic, then this function is equivalent to TS::decl().
Source§

fn decl() -> String

Declaration of this type, e.g. type User = { user_id: number, ... }. This function will panic if the type has no declaration. Read more
Source§

fn inline() -> String

Formats this types definition in TypeScript, e.g { user_id: number }. This function will panic if the type cannot be inlined.
Source§

fn inline_flattened() -> String

Flatten a type declaration.
This function will panic if the type cannot be flattened.
Source§

fn visit_generics(v: &mut impl TypeVisitor)
where Self: 'static,

Iterates over all type parameters of this type.
Source§

fn output_path() -> Option<PathBuf>

Returns the output path to where T should be exported.
The returned path does not include the base directory from TS_RS_EXPORT_DIR. Read more
Source§

fn visit_dependencies(v: &mut impl TypeVisitor)
where Self: 'static,

Iterates over all dependency of this type.
Source§

fn dependencies() -> Vec<Dependency>
where Self: 'static,

Resolves all dependencies of this type recursively.
Source§

fn export() -> Result<(), ExportError>
where Self: 'static,

Manually export this type to the filesystem. To export this type together with all of its dependencies, use TS::export_all. Read more
Source§

fn export_all() -> Result<(), ExportError>
where Self: 'static,

Manually export this type to the filesystem, together with all of its dependencies.
To export only this type, without its dependencies, use TS::export. Read more
Source§

fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>
where Self: 'static,

Manually export this type into the given directory, together with all of its dependencies.
To export only this type, without its dependencies, use TS::export. Read more
Source§

fn export_to_string() -> Result<String, ExportError>
where Self: 'static,

Manually generate bindings for this type, returning a String.
This function does not format the output, even if the format feature is enabled. Read more
Source§

fn default_output_path() -> Option<PathBuf>

Returns the output path to where T should be exported. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,