mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 07:55:59 +02:00
Misc doc fixes (#12266)
# Description Just a bunch of miscellaneous fixes to the Rust documentation that I found recently while doing a pass on some things. # User-Facing Changes None
This commit is contained in:
@ -10,8 +10,8 @@
|
||||
//! over stdin and stdout using a standardizes serialization framework to exchange
|
||||
//! the typed data that Nushell commands utilize natively.
|
||||
//!
|
||||
//! A typical plugin application will define a struct that implements the [Plugin]
|
||||
//! trait and then, in it's main method, pass that [Plugin] to the [serve_plugin]
|
||||
//! A typical plugin application will define a struct that implements the [`Plugin`]
|
||||
//! trait and then, in its main method, pass that [`Plugin`] to the [`serve_plugin()`]
|
||||
//! function, which will handle all of the input and output serialization when
|
||||
//! invoked by Nushell.
|
||||
//!
|
||||
|
@ -5,7 +5,8 @@ use crate::{EngineInterface, EvaluatedCall, Plugin};
|
||||
/// The API for a Nushell plugin command
|
||||
///
|
||||
/// This is the trait that Nushell plugin commands must implement. The methods defined on
|
||||
/// `PluginCommand` are invoked by [serve_plugin] during plugin registration and execution.
|
||||
/// `PluginCommand` are invoked by [`serve_plugin`](crate::serve_plugin) during plugin registration
|
||||
/// and execution.
|
||||
///
|
||||
/// The plugin command must be able to be safely shared between threads, so that multiple
|
||||
/// invocations can be run in parallel. If interior mutability is desired, consider synchronization
|
||||
@ -73,8 +74,8 @@ pub trait PluginCommand: Sync {
|
||||
/// Perform the actual behavior of the plugin command
|
||||
///
|
||||
/// The behavior of the plugin is defined by the implementation of this method. When Nushell
|
||||
/// invoked the plugin [serve_plugin] will call this method and print the serialized returned
|
||||
/// value or error to stdout, which Nushell will interpret.
|
||||
/// invoked the plugin [`serve_plugin`](crate::serve_plugin) will call this method and print the
|
||||
/// serialized returned value or error to stdout, which Nushell will interpret.
|
||||
///
|
||||
/// `engine` provides an interface back to the Nushell engine. See [`EngineInterface`] docs for
|
||||
/// details on what methods are available.
|
||||
@ -156,8 +157,8 @@ pub trait SimplePluginCommand: Sync {
|
||||
/// Perform the actual behavior of the plugin command
|
||||
///
|
||||
/// The behavior of the plugin is defined by the implementation of this method. When Nushell
|
||||
/// invoked the plugin [serve_plugin] will call this method and print the serialized returned
|
||||
/// value or error to stdout, which Nushell will interpret.
|
||||
/// invoked the plugin [`serve_plugin`](crate::serve_plugin) will call this method and print the
|
||||
/// serialized returned value or error to stdout, which Nushell will interpret.
|
||||
///
|
||||
/// `engine` provides an interface back to the Nushell engine. See [`EngineInterface`] docs for
|
||||
/// details on what methods are available.
|
||||
|
@ -57,8 +57,8 @@ pub(crate) const OUTPUT_BUFFER_SIZE: usize = 8192;
|
||||
pub trait Encoder<T>: Clone + Send + Sync {
|
||||
/// Serialize a value in the [`PluginEncoder`]s format
|
||||
///
|
||||
/// Returns [ShellError::IOError] if there was a problem writing, or
|
||||
/// [ShellError::PluginFailedToEncode] for a serialization error.
|
||||
/// Returns [`ShellError::IOError`] if there was a problem writing, or
|
||||
/// [`ShellError::PluginFailedToEncode`] for a serialization error.
|
||||
#[doc(hidden)]
|
||||
fn encode(&self, data: &T, writer: &mut impl std::io::Write) -> Result<(), ShellError>;
|
||||
|
||||
@ -66,8 +66,8 @@ pub trait Encoder<T>: Clone + Send + Sync {
|
||||
///
|
||||
/// Returns `None` if there is no more output to receive.
|
||||
///
|
||||
/// Returns [ShellError::IOError] if there was a problem reading, or
|
||||
/// [ShellError::PluginFailedToDecode] for a deserialization error.
|
||||
/// Returns [`ShellError::IOError`] if there was a problem reading, or
|
||||
/// [`ShellError::PluginFailedToDecode`] for a deserialization error.
|
||||
#[doc(hidden)]
|
||||
fn decode(&self, reader: &mut impl std::io::BufRead) -> Result<Option<T>, ShellError>;
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A representation of the plugin's invocation command including command line args
|
||||
///
|
||||
/// The `EvaluatedCall` contains information about the way a [Plugin](crate::Plugin) was invoked
|
||||
/// The `EvaluatedCall` contains information about the way a [`Plugin`](crate::Plugin) was invoked
|
||||
/// representing the [`Span`] corresponding to the invocation as well as the arguments
|
||||
/// it was invoked with. It is one of three items passed to [`run`](crate::Plugin::run()) along with
|
||||
/// it was invoked with. It is one of three items passed to [`run()`](crate::PluginCommand::run()) along with
|
||||
/// `name` which command that was invoked and a [`Value`] that represents the input.
|
||||
///
|
||||
/// The evaluated call is used with the Plugins because the plugin doesn't have
|
||||
|
@ -353,7 +353,7 @@ pub enum PluginOption {
|
||||
GcDisabled(bool),
|
||||
}
|
||||
|
||||
/// This is just a serializable version of [std::cmp::Ordering], and can be converted 1:1
|
||||
/// This is just a serializable version of [`std::cmp::Ordering`], and can be converted 1:1
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
pub enum Ordering {
|
||||
Less,
|
||||
@ -505,7 +505,7 @@ impl<D> EngineCall<D> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The response to an [EngineCall]. The type parameter determines the output type for pipeline
|
||||
/// The response to an [`EngineCall`]. The type parameter determines the output type for pipeline
|
||||
/// data.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub enum EngineCallResponse<D> {
|
||||
|
Reference in New Issue
Block a user