mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 01:43:47 +01:00
Fix bad method links in docstrings (#13471)
# Description Seems like I developed a bit of a bad habit of trying to link ```rust /// [`.foo()`] ``` in docstrings, and this just doesn't work automatically; you have to do ```rust /// [`.foo()`](Self::foo) ``` if you want it to actually link. I think I found and replaced all of these. # User-Facing Changes Just docs.
This commit is contained in:
parent
d80de68665
commit
d618fd0527
@ -423,7 +423,7 @@ impl BlockBuilder {
|
|||||||
self.push(Instruction::Jump { index: label_id.0 }.into_spanned(span))
|
self.push(Instruction::Jump { index: label_id.0 }.into_spanned(span))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The index that the next instruction [`.push()`]ed will have.
|
/// The index that the next instruction [`.push()`](Self::push)ed will have.
|
||||||
pub(crate) fn here(&self) -> usize {
|
pub(crate) fn here(&self) -> usize {
|
||||||
self.instructions.len()
|
self.instructions.len()
|
||||||
}
|
}
|
||||||
|
@ -122,11 +122,11 @@ impl CommunicationMode {
|
|||||||
|
|
||||||
/// The result of [`CommunicationMode::serve()`], which acts as an intermediate stage for
|
/// The result of [`CommunicationMode::serve()`], which acts as an intermediate stage for
|
||||||
/// communication modes that require some kind of socket binding to occur before the client process
|
/// communication modes that require some kind of socket binding to occur before the client process
|
||||||
/// can be started. Call [`.connect()`] once the client process has been started.
|
/// can be started. Call [`.connect()`](Self::connect) once the client process has been started.
|
||||||
///
|
///
|
||||||
/// The socket may be cleaned up on `Drop` if applicable.
|
/// The socket may be cleaned up on `Drop` if applicable.
|
||||||
pub enum PreparedServerCommunication {
|
pub enum PreparedServerCommunication {
|
||||||
/// Will take stdin and stdout from the process on [`.connect()`].
|
/// Will take stdin and stdout from the process on [`.connect()`](Self::connect).
|
||||||
Stdio,
|
Stdio,
|
||||||
/// Contains the listener to accept connections on. On Unix, the socket is unlinked on `Drop`.
|
/// Contains the listener to accept connections on. On Unix, the socket is unlinked on `Drop`.
|
||||||
#[cfg(feature = "local-socket")]
|
#[cfg(feature = "local-socket")]
|
||||||
|
@ -145,7 +145,7 @@ pub trait InterfaceManager {
|
|||||||
|
|
||||||
/// Consume an input message.
|
/// Consume an input message.
|
||||||
///
|
///
|
||||||
/// When implementing, call [`.consume_stream_message()`] for any encapsulated
|
/// When implementing, call [`.consume_stream_message()`](Self::consume_stream_message) for any encapsulated
|
||||||
/// [`StreamMessage`]s received.
|
/// [`StreamMessage`]s received.
|
||||||
fn consume(&mut self, input: Self::Input) -> Result<(), ShellError>;
|
fn consume(&mut self, input: Self::Input) -> Result<(), ShellError>;
|
||||||
|
|
||||||
|
@ -189,14 +189,14 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the stream was dropped from the other end. Recommended to do this before calling
|
/// Check if the stream was dropped from the other end. Recommended to do this before calling
|
||||||
/// [`.write()`], especially in a loop.
|
/// [`.write()`](Self::write), especially in a loop.
|
||||||
pub fn is_dropped(&self) -> Result<bool, ShellError> {
|
pub fn is_dropped(&self) -> Result<bool, ShellError> {
|
||||||
self.signal.is_dropped()
|
self.signal.is_dropped()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write a single piece of data to the stream.
|
/// Write a single piece of data to the stream.
|
||||||
///
|
///
|
||||||
/// Error if something failed with the write, or if [`.end()`] was already called
|
/// Error if something failed with the write, or if [`.end()`](Self::end) was already called
|
||||||
/// previously.
|
/// previously.
|
||||||
pub fn write(&mut self, data: impl Into<StreamData>) -> Result<(), ShellError> {
|
pub fn write(&mut self, data: impl Into<StreamData>) -> Result<(), ShellError> {
|
||||||
if !self.ended {
|
if !self.ended {
|
||||||
@ -228,7 +228,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Write a full iterator to the stream. Note that this doesn't end the stream, so you should
|
/// Write a full iterator to the stream. Note that this doesn't end the stream, so you should
|
||||||
/// still call [`.end()`].
|
/// still call [`.end()`](Self::end).
|
||||||
///
|
///
|
||||||
/// If the stream is dropped from the other end, the iterator will not be fully consumed, and
|
/// If the stream is dropped from the other end, the iterator will not be fully consumed, and
|
||||||
/// writing will terminate.
|
/// writing will terminate.
|
||||||
@ -341,8 +341,8 @@ impl StreamWriterSignal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Track that a message has been sent. Returns `Ok(true)` if more messages can be sent,
|
/// Track that a message has been sent. Returns `Ok(true)` if more messages can be sent,
|
||||||
/// or `Ok(false)` if the high pressure mark has been reached and [`.wait_for_drain()`] should
|
/// or `Ok(false)` if the high pressure mark has been reached and
|
||||||
/// be called to block.
|
/// [`.wait_for_drain()`](Self::wait_for_drain) should be called to block.
|
||||||
pub fn notify_sent(&self) -> Result<bool, ShellError> {
|
pub fn notify_sent(&self) -> Result<bool, ShellError> {
|
||||||
let mut state = self.lock()?;
|
let mut state = self.lock()?;
|
||||||
state.unacknowledged =
|
state.unacknowledged =
|
||||||
|
@ -45,7 +45,7 @@ fn fail_if_poisoned<'a, T>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone + Send> WaitableMut<T> {
|
impl<T: Clone + Send> WaitableMut<T> {
|
||||||
/// Create a new empty `WaitableMut`. Call [`.reader()`] to get [`Waitable`].
|
/// Create a new empty `WaitableMut`. Call [`.reader()`](Self::reader) to get [`Waitable`].
|
||||||
pub fn new() -> WaitableMut<T> {
|
pub fn new() -> WaitableMut<T> {
|
||||||
WaitableMut {
|
WaitableMut {
|
||||||
shared: Arc::new(WaitableShared {
|
shared: Arc::new(WaitableShared {
|
||||||
|
@ -80,8 +80,8 @@ impl PluginGc {
|
|||||||
///
|
///
|
||||||
/// The reason the plugin tells the GC rather than just stopping itself via `source` is that
|
/// The reason the plugin tells the GC rather than just stopping itself via `source` is that
|
||||||
/// it can't guarantee that the plugin currently pointed to by `source` is itself, but if the
|
/// it can't guarantee that the plugin currently pointed to by `source` is itself, but if the
|
||||||
/// GC is still running, it hasn't received [`.stop_tracking()`] yet, which means it should be
|
/// GC is still running, it hasn't received [`.stop_tracking()`](Self::stop_tracking) yet, which
|
||||||
/// the right plugin.
|
/// means it should be the right plugin.
|
||||||
pub fn exited(&self) {
|
pub fn exited(&self) {
|
||||||
let _ = self.sender.send(PluginGcMsg::Exited);
|
let _ = self.sender.send(PluginGcMsg::Exited);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ impl PluginSource {
|
|||||||
|
|
||||||
/// Create a new fake source with a fake identity, for testing
|
/// Create a new fake source with a fake identity, for testing
|
||||||
///
|
///
|
||||||
/// Warning: [`.persistent()`] will always return an error.
|
/// Warning: [`.persistent()`](Self::persistent) will always return an error.
|
||||||
pub fn new_fake(name: &str) -> PluginSource {
|
pub fn new_fake(name: &str) -> PluginSource {
|
||||||
PluginSource {
|
PluginSource {
|
||||||
identity: PluginIdentity::new_fake(name).into(),
|
identity: PluginIdentity::new_fake(name).into(),
|
||||||
|
@ -85,19 +85,19 @@ impl EvaluatedCall {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builder variant of [`.add_positional()`].
|
/// Builder variant of [`.add_positional()`](Self::add_positional).
|
||||||
pub fn with_positional(mut self, value: Value) -> Self {
|
pub fn with_positional(mut self, value: Value) -> Self {
|
||||||
self.add_positional(value);
|
self.add_positional(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builder variant of [`.add_named()`].
|
/// Builder variant of [`.add_named()`](Self::add_named).
|
||||||
pub fn with_named(mut self, name: Spanned<impl Into<String>>, value: Value) -> Self {
|
pub fn with_named(mut self, name: Spanned<impl Into<String>>, value: Value) -> Self {
|
||||||
self.add_named(name, value);
|
self.add_named(name, value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builder variant of [`.add_flag()`].
|
/// Builder variant of [`.add_flag()`](Self::add_flag).
|
||||||
pub fn with_flag(mut self, name: Spanned<impl Into<String>>) -> Self {
|
pub fn with_flag(mut self, name: Spanned<impl Into<String>>) -> Self {
|
||||||
self.add_flag(name);
|
self.add_flag(name);
|
||||||
self
|
self
|
||||||
|
@ -75,8 +75,8 @@ use crate::{EngineInterface, EvaluatedCall, Plugin};
|
|||||||
pub trait PluginCommand: Sync {
|
pub trait PluginCommand: Sync {
|
||||||
/// The type of plugin this command runs on.
|
/// The type of plugin this command runs on.
|
||||||
///
|
///
|
||||||
/// Since [`.run()`] takes a reference to the plugin, it is necessary to define the type of
|
/// Since [`.run()`](Self::run) takes a reference to the plugin, it is necessary to define the
|
||||||
/// plugin that the command expects here.
|
/// type of plugin that the command expects here.
|
||||||
type Plugin: Plugin;
|
type Plugin: Plugin;
|
||||||
|
|
||||||
/// The name of the command from within Nu.
|
/// The name of the command from within Nu.
|
||||||
@ -96,9 +96,9 @@ pub trait PluginCommand: Sync {
|
|||||||
|
|
||||||
/// Additional documentation for usage of the command.
|
/// Additional documentation for usage of the command.
|
||||||
///
|
///
|
||||||
/// This is optional - any arguments documented by [`.signature()`] will be shown in the help
|
/// This is optional - any arguments documented by [`.signature()`](Self::signature) will be
|
||||||
/// page automatically. However, this can be useful for explaining things that would be too
|
/// shown in the help page automatically. However, this can be useful for explaining things that
|
||||||
/// brief to include in [`.usage()`] and may span multiple lines.
|
/// would be too brief to include in [`.usage()`](Self::usage) and may span multiple lines.
|
||||||
fn extra_usage(&self) -> &str {
|
fn extra_usage(&self) -> &str {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
@ -618,8 +618,9 @@ impl EngineInterface {
|
|||||||
|
|
||||||
/// Get all environment variables from the engine.
|
/// Get all environment variables from the engine.
|
||||||
///
|
///
|
||||||
/// Since this is quite a large map that has to be sent, prefer to use [`.get_env_var()`] if
|
/// Since this is quite a large map that has to be sent, prefer to use
|
||||||
/// the variables needed are known ahead of time and there are only a small number needed.
|
/// [`.get_env_var()`] (Self::get_env_var) if the variables needed are known ahead of time
|
||||||
|
/// and there are only a small number needed.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```rust,no_run
|
/// ```rust,no_run
|
||||||
@ -873,9 +874,9 @@ impl EngineInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Ask the engine for the identifier for a declaration. If found, the result can then be passed
|
/// Ask the engine for the identifier for a declaration. If found, the result can then be passed
|
||||||
/// to [`.call_decl()`] to call other internal commands.
|
/// to [`.call_decl()`](Self::call_decl) to call other internal commands.
|
||||||
///
|
///
|
||||||
/// See [`.call_decl()`] for an example.
|
/// See [`.call_decl()`](Self::call_decl) for an example.
|
||||||
pub fn find_decl(&self, name: impl Into<String>) -> Result<Option<DeclId>, ShellError> {
|
pub fn find_decl(&self, name: impl Into<String>) -> Result<Option<DeclId>, ShellError> {
|
||||||
let call = EngineCall::FindDecl(name.into());
|
let call = EngineCall::FindDecl(name.into());
|
||||||
|
|
||||||
@ -890,7 +891,7 @@ impl EngineInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Ask the engine to call an internal command, using the declaration ID previously looked up
|
/// Ask the engine to call an internal command, using the declaration ID previously looked up
|
||||||
/// with [`.find_decl()`].
|
/// with [`.find_decl()`](Self::find_decl).
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
@ -1008,7 +1009,7 @@ impl Interface for EngineInterface {
|
|||||||
|
|
||||||
/// Keeps the plugin in the foreground as long as it is alive.
|
/// Keeps the plugin in the foreground as long as it is alive.
|
||||||
///
|
///
|
||||||
/// Use [`.leave()`] to leave the foreground without ignoring the error.
|
/// Use [`.leave()`](Self::leave) to leave the foreground without ignoring the error.
|
||||||
pub struct ForegroundGuard(Option<EngineInterface>);
|
pub struct ForegroundGuard(Option<EngineInterface>);
|
||||||
|
|
||||||
impl ForegroundGuard {
|
impl ForegroundGuard {
|
||||||
|
@ -832,9 +832,9 @@ impl EngineState {
|
|||||||
|
|
||||||
/// Optionally get a block by id, if it exists
|
/// Optionally get a block by id, if it exists
|
||||||
///
|
///
|
||||||
/// Prefer to use [`.get_block()`] in most cases - `BlockId`s that don't exist are normally a
|
/// Prefer to use [`.get_block()`](Self::get_block) in most cases - `BlockId`s that don't exist
|
||||||
/// compiler error. This only exists to stop plugins from crashing the engine if they send us
|
/// are normally a compiler error. This only exists to stop plugins from crashing the engine if
|
||||||
/// something invalid.
|
/// they send us something invalid.
|
||||||
pub fn try_get_block(&self, block_id: BlockId) -> Option<&Arc<Block>> {
|
pub fn try_get_block(&self, block_id: BlockId) -> Option<&Arc<Block>> {
|
||||||
self.blocks.get(block_id)
|
self.blocks.get(block_id)
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ pub struct Stack {
|
|||||||
pub parent_stack: Option<Arc<Stack>>,
|
pub parent_stack: Option<Arc<Stack>>,
|
||||||
/// Variables that have been deleted (this is used to hide values from parent stack lookups)
|
/// Variables that have been deleted (this is used to hide values from parent stack lookups)
|
||||||
pub parent_deletions: Vec<VarId>,
|
pub parent_deletions: Vec<VarId>,
|
||||||
/// Locally updated config. Use [`.get_config()`] to access correctly.
|
/// Locally updated config. Use [`.get_config()`](Self::get_config) to access correctly.
|
||||||
pub config: Option<Arc<Config>>,
|
pub config: Option<Arc<Config>>,
|
||||||
pub(crate) out_dest: StackOutDest,
|
pub(crate) out_dest: StackOutDest,
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ pub struct LabeledError {
|
|||||||
impl LabeledError {
|
impl LabeledError {
|
||||||
/// Create a new plain [`LabeledError`] with the given message.
|
/// Create a new plain [`LabeledError`] with the given message.
|
||||||
///
|
///
|
||||||
/// This is usually used builder-style with methods like [`.with_label()`] to build an error.
|
/// This is usually used builder-style with methods like [`.with_label()`](Self::with_label) to
|
||||||
|
/// build an error.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
|
@ -117,7 +117,8 @@ impl PipelineData {
|
|||||||
/// Get a type that is representative of the `PipelineData`.
|
/// Get a type that is representative of the `PipelineData`.
|
||||||
///
|
///
|
||||||
/// The type returned here makes no effort to collect a stream, so it may be a different type
|
/// The type returned here makes no effort to collect a stream, so it may be a different type
|
||||||
/// than would be returned by [`Value::get_type()`] on the result of [`.into_value()`].
|
/// than would be returned by [`Value::get_type()`] on the result of
|
||||||
|
/// [`.into_value()`](Self::into_value).
|
||||||
///
|
///
|
||||||
/// Specifically, a `ListStream` results in [`list stream`](Type::ListStream) rather than
|
/// Specifically, a `ListStream` results in [`list stream`](Type::ListStream) rather than
|
||||||
/// the fully complete [`list`](Type::List) type (which would require knowing the contents),
|
/// the fully complete [`list`](Type::List) type (which would require knowing the contents),
|
||||||
|
@ -105,10 +105,10 @@ impl Drop for ForegroundChild {
|
|||||||
///
|
///
|
||||||
/// If there is already a foreground external process running, spawned with [`ForegroundChild`],
|
/// If there is already a foreground external process running, spawned with [`ForegroundChild`],
|
||||||
/// this expects the process ID to remain in the process group created by the [`ForegroundChild`]
|
/// this expects the process ID to remain in the process group created by the [`ForegroundChild`]
|
||||||
/// for the lifetime of the guard, and keeps the terminal controlling process group set to that. If
|
/// for the lifetime of the guard, and keeps the terminal controlling process group set to that.
|
||||||
/// there is no foreground external process running, this sets the foreground process group to the
|
/// If there is no foreground external process running, this sets the foreground process group to
|
||||||
/// plugin's process ID. The process group that is expected can be retrieved with [`.pgrp()`] if
|
/// the plugin's process ID. The process group that is expected can be retrieved with
|
||||||
/// different from the plugin process ID.
|
/// [`.pgrp()`](Self::pgrp) if different from the plugin process ID.
|
||||||
///
|
///
|
||||||
/// ## Other systems
|
/// ## Other systems
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user