repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-cmd-base/src/wrap_call.rs
crates/nu-cmd-base/src/wrap_call.rs
use nu_engine::CallExt; use nu_protocol::{ DeclId, FromValue, ShellError, Span, engine::{Call, EngineState, Stack, StateWorkingSet}, }; /// A helper utility to aid in implementing commands which have the same behavior for `run` and `run_const`. /// /// Only supports functions in [`Call`] and [`CallExt`] which ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-cmd-base/src/formats/mod.rs
crates/nu-cmd-base/src/formats/mod.rs
pub mod to;
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-cmd-base/src/formats/to/mod.rs
crates/nu-cmd-base/src/formats/to/mod.rs
pub mod delimited;
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-cmd-base/src/formats/to/delimited.rs
crates/nu-cmd-base/src/formats/to/delimited.rs
use indexmap::{IndexSet, indexset}; use nu_protocol::Value; pub fn merge_descriptors(values: &[Value]) -> Vec<String> { let mut ret: Vec<String> = vec![]; let mut seen: IndexSet<String> = indexset! {}; for value in values { let data_descriptors = match value { Value::Record { val, .. } ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/ast.rs
crates/nu-lsp/src/ast.rs
use crate::Id; use nu_protocol::{ DeclId, ModuleId, Span, ast::{Argument, Block, Call, Expr, Expression, FindMapResult, ListItem, PathMember, Traverse}, engine::StateWorkingSet, }; use std::sync::Arc; /// Adjust span if quoted fn strip_quotes(span: Span, working_set: &StateWorkingSet) -> (Box<[u8]>, Span) ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/workspace.rs
crates/nu-lsp/src/workspace.rs
use crate::{ Id, LanguageServer, ast::{self, find_id, find_reference_by_id}, path_to_uri, span_to_range, uri_to_path, }; use lsp_textdocument::FullTextDocument; use lsp_types::{ DocumentHighlight, DocumentHighlightKind, DocumentHighlightParams, Location, PrepareRenameResponse, ProgressToken, Range, ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
true
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/diagnostics.rs
crates/nu-lsp/src/diagnostics.rs
use crate::{LanguageServer, span_to_range}; use lsp_types::{ Diagnostic, DiagnosticSeverity, PublishDiagnosticsParams, Uri, notification::{Notification, PublishDiagnostics}, }; use miette::{IntoDiagnostic, Result, miette}; impl LanguageServer { pub(crate) fn publish_diagnostics_for_file(&mut self, uri: Uri...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/goto.rs
crates/nu-lsp/src/goto.rs
use std::path::Path; use crate::{Id, LanguageServer, path_to_uri, span_to_range}; use lsp_textdocument::FullTextDocument; use lsp_types::{GotoDefinitionParams, GotoDefinitionResponse, Location}; use nu_protocol::Span; use nu_protocol::engine::{CachedFile, StateWorkingSet}; impl LanguageServer { fn get_location_by...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/lib.rs
crates/nu-lsp/src/lib.rs
#![doc = include_str!("../README.md")] use lsp_server::{Connection, IoThreads, Message, Response, ResponseError}; use lsp_textdocument::{FullTextDocument, TextDocuments}; use lsp_types::{ InlayHint, MessageType, OneOf, Position, Range, ReferencesOptions, RenameOptions, SemanticToken, SemanticTokenType, Semantic...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/signature.rs
crates/nu-lsp/src/signature.rs
use lsp_types::{ Documentation, MarkupContent, MarkupKind, ParameterInformation, SignatureHelp, SignatureHelpParams, SignatureInformation, }; use nu_protocol::{ Flag, PositionalArg, Signature, SyntaxShape, Value, ast::{Argument, Call, Expr, Expression, FindMapResult, Traverse}, engine::StateWorkingS...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/completion.rs
crates/nu-lsp/src/completion.rs
use std::sync::Arc; use crate::{LanguageServer, span_to_range, uri_to_path}; use lsp_types::{ CompletionItem, CompletionItemKind, CompletionItemLabelDetails, CompletionParams, CompletionResponse, CompletionTextEdit, Documentation, InsertTextFormat, MarkupContent, MarkupKind, Range, TextEdit, }; use nu_cli:...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/semantic_tokens.rs
crates/nu-lsp/src/semantic_tokens.rs
use std::sync::Arc; use lsp_textdocument::FullTextDocument; use lsp_types::{SemanticToken, SemanticTokens, SemanticTokensParams}; use nu_protocol::{ Span, ast::{Block, Expr, Expression, Traverse}, engine::StateWorkingSet, }; use crate::{LanguageServer, span_to_range}; /// Important to keep spans in incre...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/notification.rs
crates/nu-lsp/src/notification.rs
use crate::LanguageServer; use lsp_types::{ DidChangeTextDocumentParams, DidChangeWorkspaceFoldersParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, LogMessageParams, MessageType, ProgressParams, ProgressParamsValue, ProgressToken, Uri, WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressEn...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/hover.rs
crates/nu-lsp/src/hover.rs
use lsp_types::{Hover, HoverContents, HoverParams, MarkupContent, MarkupKind}; use nu_protocol::{PositionalArg, engine::Command}; use std::borrow::Cow; use crate::{ Id, LanguageServer, signature::{display_flag, doc_for_arg, get_signature_label}, }; impl LanguageServer { pub(crate) fn get_decl_description(...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/symbols.rs
crates/nu-lsp/src/symbols.rs
use crate::{Id, LanguageServer, path_to_uri, span_to_range, uri_to_path}; use lsp_textdocument::{FullTextDocument, TextDocuments}; use lsp_types::{ DocumentSymbolParams, DocumentSymbolResponse, Location, Range, SymbolInformation, SymbolKind, Uri, WorkspaceSymbolParams, WorkspaceSymbolResponse, }; use nu_protoco...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-lsp/src/hints.rs
crates/nu-lsp/src/hints.rs
use crate::{LanguageServer, span_to_range}; use lsp_textdocument::FullTextDocument; use lsp_types::{ InlayHint, InlayHintKind, InlayHintLabel, InlayHintParams, InlayHintTooltip, MarkupContent, MarkupKind, Position, Range, }; use nu_protocol::{ Type, ast::{Argument, Block, Expr, Expression, Operator, Tra...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-mcp/src/lib.rs
crates/nu-mcp/src/lib.rs
use nu_protocol::{ShellError, engine::EngineState, engine::StateWorkingSet, format_cli_error}; use rmcp::{ServiceExt, transport::stdio}; use server::NushellMcpServer; use tokio::runtime::Runtime; use tracing_subscriber::EnvFilter; use rmcp::ErrorData as McpError; mod evaluation; mod history; mod server; pub fn initi...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-mcp/src/history.rs
crates/nu-mcp/src/history.rs
use nu_protocol::{ Span, Type, Value, VarId, engine::{EngineState, Stack, StateWorkingSet}, }; use std::collections::VecDeque; const HISTORY_LIMIT_ENV_VAR: &str = "NU_MCP_HISTORY_LIMIT"; const DEFAULT_HISTORY_LIMIT: usize = 100; /// Ring buffer for storing command output history. /// /// Maintains a fixed-siz...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-mcp/src/server.rs
crates/nu-mcp/src/server.rs
use std::sync::Arc; use nu_protocol::{UseAnsiColoring, engine::EngineState}; use rmcp::{ ErrorData as McpError, ServerHandler, handler::server::{tool::ToolRouter, wrapper::Parameters}, model::{ServerCapabilities, ServerInfo}, tool, tool_handler, tool_router, }; use schemars::JsonSchema; use serde::{Des...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-mcp/src/evaluation.rs
crates/nu-mcp/src/evaluation.rs
use crate::{history::History, shell_error_to_mcp_error}; use nu_protocol::{ PipelineData, PipelineExecutionData, Span, Value, debugger::WithoutDebug, engine::{EngineState, Stack, StateWorkingSet}, }; use std::{ sync::Mutex, time::{SystemTime, UNIX_EPOCH}, }; const OUTPUT_LIMIT_ENV_VAR: &str = "NU_M...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin/src/lib.rs
crates/nu-plugin/src/lib.rs
#![allow(clippy::needless_doctest_main)] //! # Nu Plugin: Plugin library for Nushell //! //! This crate contains the interface necessary to build Nushell plugins in Rust. //! Additionally, it contains public, but undocumented, items used by Nushell itself //! to interface with Nushell plugins. This documentation focuse...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin/src/test_util.rs
crates/nu-plugin/src/test_util.rs
use nu_plugin_core::interface_test_util::TestCase; use nu_plugin_protocol::{PluginInput, PluginOutput}; use crate::plugin::EngineInterfaceManager; pub trait TestCaseExt { /// Create a new [`EngineInterfaceManager`] that writes to this test case. fn engine(&self) -> EngineInterfaceManager; } impl TestCaseExt ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin/src/plugin/command.rs
crates/nu-plugin/src/plugin/command.rs
use nu_protocol::{ DynamicSuggestion, Example, IntoSpanned, LabeledError, PipelineData, PluginExample, PluginSignature, ShellError, Signature, Value, engine::ArgType, }; use crate::{DynamicCompletionCall, EngineInterface, EvaluatedCall, Plugin}; /// The API for a Nushell plugin command /// /// This is the tra...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin/src/plugin/mod.rs
crates/nu-plugin/src/plugin/mod.rs
use std::{ cmp::Ordering, collections::HashMap, env, ffi::OsString, ops::Deref, panic::AssertUnwindSafe, path::Path, sync::mpsc::{self, TrySendError}, thread, }; use nu_engine::documentation::{FormatterValue, HelpStyle, get_flags_section}; use nu_plugin_core::{ ClientCommunicati...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin/src/plugin/interface/tests.rs
crates/nu-plugin/src/plugin/interface/tests.rs
use crate::test_util::TestCaseExt; use super::{EngineInterfaceManager, ReceivedPluginCall}; use nu_engine::command_prelude::IoError; use nu_plugin_core::{Interface, InterfaceManager, interface_test_util::TestCase}; use nu_plugin_protocol::{ ByteStreamInfo, CallInfo, CustomValueOp, EngineCall, EngineCallId, EngineC...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
true
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin/src/plugin/interface/mod.rs
crates/nu-plugin/src/plugin/interface/mod.rs
//! Interface used by the plugin to communicate with the engine. use nu_plugin_core::{ Interface, InterfaceManager, PipelineDataWriter, PluginRead, PluginWrite, StreamManager, StreamManagerHandle, util::{Waitable, WaitableMut}, }; use nu_plugin_protocol::{ CallInfo, CustomValueOp, EngineCall, EngineCal...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
true
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/declaration.rs
crates/nu-plugin-engine/src/declaration.rs
use nu_engine::{command_prelude::*, get_eval_expression}; use nu_plugin_protocol::{ CallInfo, DynamicCompletionCall, EvaluatedCall, GetCompletionArgType, GetCompletionInfo, }; use nu_protocol::engine::ArgType; use nu_protocol::{DynamicCompletionCallRef, DynamicSuggestion}; use nu_protocol::{PluginIdentity, PluginSi...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/source.rs
crates/nu-plugin-engine/src/source.rs
use super::GetPlugin; use nu_protocol::{PluginIdentity, ShellError, Span}; use std::sync::{Arc, Weak}; /// The source of a custom value or plugin command. Includes a weak reference to the persistent /// plugin so it can be retrieved. #[derive(Debug, Clone)] pub struct PluginSource { /// The identity of the plugin ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/lib.rs
crates/nu-plugin-engine/src/lib.rs
//! Provides functionality for running Nushell plugins from a Nushell engine. mod context; mod declaration; mod gc; mod init; mod interface; mod persistent; mod plugin_custom_value_with_source; mod process; mod source; mod util; #[cfg(test)] mod test_util; pub use context::{PluginExecutionCommandContext, PluginExecu...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/gc.rs
crates/nu-plugin-engine/src/gc.rs
use crate::PersistentPlugin; use nu_protocol::{PluginGcConfig, RegisteredPlugin}; use std::{ sync::{Arc, Weak, mpsc}, thread, time::{Duration, Instant}, }; /// Plugin garbage collector /// /// Many users don't want all of their plugins to stay running indefinitely after using them, so /// this runs a threa...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/process.rs
crates/nu-plugin-engine/src/process.rs
use std::sync::{Arc, Mutex, MutexGuard, atomic::AtomicU32}; use nu_protocol::{ShellError, Span}; use nu_system::ForegroundGuard; /// Provides a utility interface for a plugin interface to manage the process the plugin is running /// in. #[derive(Debug)] pub(crate) struct PluginProcess { pid: u32, mutable: Mut...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/test_util.rs
crates/nu-plugin-engine/src/test_util.rs
use std::sync::Arc; use nu_plugin_core::interface_test_util::TestCase; use nu_plugin_protocol::{PluginInput, PluginOutput, test_util::test_plugin_custom_value}; use crate::{PluginCustomValueWithSource, PluginInterfaceManager, PluginSource}; pub trait TestCaseExt { /// Create a new [`PluginInterfaceManager`] that...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/init.rs
crates/nu-plugin-engine/src/init.rs
use std::{ io::{BufReader, BufWriter}, path::Path, process::Child, sync::{Arc, Mutex}, }; #[cfg(unix)] use std::os::unix::process::CommandExt; #[cfg(windows)] use std::os::windows::process::CommandExt; use nu_plugin_core::{ CommunicationMode, EncodingType, InterfaceManager, PreparedServerCommunica...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/persistent.rs
crates/nu-plugin-engine/src/persistent.rs
use crate::{ PluginGc, init::{create_command, make_plugin_interface}, }; use super::{PluginInterface, PluginSource}; use nu_plugin_core::CommunicationMode; use nu_protocol::{ HandlerGuard, Handlers, PluginGcConfig, PluginIdentity, PluginMetadata, RegisteredPlugin, ShellError, engine::{EngineState, ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/context.rs
crates/nu-plugin-engine/src/context.rs
use crate::util::MutableCow; use nu_engine::{ClosureEvalOnce, get_eval_block_with_early_return, get_full_help}; use nu_plugin_protocol::EvaluatedCall; use nu_protocol::{ BlockId, Config, DeclId, IntoSpanned, OutDest, PipelineData, PluginIdentity, ShellError, Signals, Span, Spanned, Value, engine::{Call, Clo...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/util/mutable_cow.rs
crates/nu-plugin-engine/src/util/mutable_cow.rs
/// Like [`Cow`][std::borrow::Cow] but with a mutable reference instead. So not exactly /// clone-on-write, but can be made owned. pub enum MutableCow<'a, T> { Borrowed(&'a mut T), Owned(T), } impl<T: Clone> MutableCow<'_, T> { pub fn owned(&self) -> MutableCow<'static, T> { match self { ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/util/mod.rs
crates/nu-plugin-engine/src/util/mod.rs
mod mutable_cow; pub use mutable_cow::MutableCow;
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/interface/tests.rs
crates/nu-plugin-engine/src/interface/tests.rs
use super::{ Context, PluginCallState, PluginInterface, PluginInterfaceManager, ReceivedPluginCallMessage, }; use crate::{ PluginCustomValueWithSource, PluginSource, context::PluginExecutionBogusContext, interface::CurrentCallState, plugin_custom_value_with_source::WithSource, test_util::*, }; use nu_engine...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
true
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/interface/mod.rs
crates/nu-plugin-engine/src/interface/mod.rs
//! Interface used by the engine to communicate with the plugin. use nu_plugin_core::{ Interface, InterfaceManager, PipelineDataWriter, PluginRead, PluginWrite, StreamManager, StreamManagerHandle, util::{Waitable, WaitableMut, with_custom_values_in}, }; use nu_plugin_protocol::{ CallInfo, CustomValueOp...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
true
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/plugin_custom_value_with_source/tests.rs
crates/nu-plugin-engine/src/plugin_custom_value_with_source/tests.rs
use std::sync::Arc; use nu_plugin_protocol::test_util::{TestCustomValue, test_plugin_custom_value}; use nu_protocol::{ BlockId, CustomValue, IntoSpanned, ShellError, Span, Value, VarId, engine::Closure, record, }; use crate::{ PluginCustomValueWithSource, PluginSource, test_util::test_plugin_custom_value_with...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-engine/src/plugin_custom_value_with_source/mod.rs
crates/nu-plugin-engine/src/plugin_custom_value_with_source/mod.rs
use std::{cmp::Ordering, path::Path, sync::Arc}; use nu_plugin_core::util::with_custom_values_in; use nu_plugin_protocol::PluginCustomValue; use nu_protocol::{ CustomValue, IntoSpanned, ShellError, Span, Spanned, Value, ast::Operator, casing::Casing, }; use serde::Serialize; use crate::{PluginInterface, PluginSou...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_inc/src/lib.rs
crates/nu_plugin_inc/src/lib.rs
mod inc; mod nu; pub use inc::Inc; pub use nu::IncPlugin;
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_inc/src/inc.rs
crates/nu_plugin_inc/src/inc.rs
use nu_protocol::{LabeledError, Span, Value, ast::CellPath}; use semver::{BuildMetadata, Prerelease, Version}; #[derive(Debug, Eq, PartialEq, Clone, Copy)] pub enum Action { SemVerAction(SemVerAction), Default, } #[derive(Debug, Eq, PartialEq, Clone, Copy)] pub enum SemVerAction { Major, Minor, Pa...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_inc/src/main.rs
crates/nu_plugin_inc/src/main.rs
use nu_plugin::{JsonSerializer, serve_plugin}; use nu_plugin_inc::IncPlugin; fn main() { serve_plugin(&IncPlugin, JsonSerializer {}) }
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_inc/src/nu/mod.rs
crates/nu_plugin_inc/src/nu/mod.rs
use crate::{Inc, inc::SemVerAction}; use nu_plugin::{EngineInterface, EvaluatedCall, Plugin, PluginCommand, SimplePluginCommand}; use nu_protocol::{LabeledError, Signature, SyntaxShape, Value, ast::CellPath}; pub struct IncPlugin; impl Plugin for IncPlugin { fn version(&self) -> String { env!("CARGO_PKG_V...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-protocol/src/evaluated_call.rs
crates/nu-plugin-protocol/src/evaluated_call.rs
use nu_protocol::{ FromValue, ShellError, Span, Spanned, Value, ast::{self, Expression}, engine::{Call, CallImpl, EngineState, Stack}, ir, }; use serde::{Deserialize, Serialize}; /// A representation of the plugin's invocation command including command line args /// /// The `EvaluatedCall` contains inf...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-protocol/src/lib.rs
crates/nu-plugin-protocol/src/lib.rs
//! Type definitions, including full `Serialize` and `Deserialize` implementations, for the protocol //! used for communication between the engine and a plugin. //! //! See the [plugin protocol reference](https://www.nushell.sh/contributor-book/plugin_protocol_reference.html) //! for more details on what exactly is bei...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-protocol/src/tests.rs
crates/nu-plugin-protocol/src/tests.rs
use super::*; #[test] fn protocol_info_compatible() -> Result<(), ShellError> { let ver_1_2_3 = ProtocolInfo { protocol: Protocol::NuPlugin, version: "1.2.3".into(), features: vec![], }; let ver_1_1_0 = ProtocolInfo { protocol: Protocol::NuPlugin, version: "1.1.0".in...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-protocol/src/test_util.rs
crates/nu-plugin-protocol/src/test_util.rs
use crate::PluginCustomValue; use nu_protocol::{CustomValue, ShellError, Span, Value}; use serde::{Deserialize, Serialize}; /// A custom value that can be used for testing. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct TestCustomValue(pub i32); #[typetag::serde(name = "nu_plugin_protocol::...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-protocol/src/protocol_info.rs
crates/nu-plugin-protocol/src/protocol_info.rs
use nu_protocol::ShellError; use semver::Prerelease; use serde::{Deserialize, Serialize}; /// Protocol information, sent as a `Hello` message on initialization. This determines the /// compatibility of the plugin and engine. They are considered to be compatible if the lower /// version is semver compatible with the hi...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-protocol/src/plugin_custom_value/tests.rs
crates/nu-plugin-protocol/src/plugin_custom_value/tests.rs
use crate::test_util::{TestCustomValue, expected_test_custom_value, test_plugin_custom_value}; use super::PluginCustomValue; use nu_protocol::{BlockId, CustomValue, ShellError, Span, Value, VarId, engine::Closure, record}; fn check_record_custom_values( val: &Value, keys: &[&str], mut f: impl FnMut(&str, ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-plugin-protocol/src/plugin_custom_value/mod.rs
crates/nu-plugin-protocol/src/plugin_custom_value/mod.rs
use std::{cmp::Ordering, path::Path}; use nu_protocol::{CustomValue, ShellError, Span, Spanned, Value, ast::Operator, casing::Casing}; use nu_utils::SharedCow; use serde::{Deserialize, Serialize}; #[cfg(test)] mod tests; /// An opaque container for a custom value that is handled fully by a plugin. /// /// This is t...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-term-grid/src/lib.rs
crates/nu-term-grid/src/lib.rs
#![doc = include_str!("../README.md")] pub mod grid; pub use grid::Grid;
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-term-grid/src/grid.rs
crates/nu-term-grid/src/grid.rs
// Thanks to https://github.com/ogham/rust-term-grid for making this available //! This library arranges textual data in a grid format suitable for //! fixed-width fonts, using an algorithm to minimise the amount of space //! needed. For example: //! //! ```rust //! use nu_term_grid::grid::{Grid, GridOptions, Directio...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-term-grid/examples/grid_demo.rs
crates/nu-term-grid/examples/grid_demo.rs
use nu_term_grid::grid::{Alignment, Cell, Direction, Filling, Grid, GridOptions}; // This produces: // // 1 | 128 | 16384 | 2097152 | 268435456 | 34359738368 | 4398046511104 // 2 | 256 | 32768 | 4194304 | 536870912 | 68719476736 | 8796093022208 // 4 | 512 | 65536 | 8388608 | 1073741824 |...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/lib.rs
crates/nu-utils/src/lib.rs
#![doc = include_str!("../README.md")] mod casing; mod deansi; pub mod emoji; pub mod filesystem; pub mod flatten_json; pub mod float; pub mod locale; mod multilife; mod nu_cow; mod quoting; mod shared_cow; mod split_read; pub mod strings; pub mod utils; pub use locale::get_system_locale; pub use utils::{ ConfigFi...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/multilife.rs
crates/nu-utils/src/multilife.rs
use std::ops::Deref; pub enum MultiLife<'out, 'local, T> where 'out: 'local, T: ?Sized, { Out(&'out T), Local(&'local T), } impl<'out, 'local, T> Deref for MultiLife<'out, 'local, T> where 'out: 'local, T: ?Sized, { type Target = T; fn deref(&self) -> &Self::Target { match *se...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/filesystem.rs
crates/nu-utils/src/filesystem.rs
#[cfg(unix)] use nix::unistd::{AccessFlags, access}; #[cfg(any(windows, unix))] use std::path::Path; // The result of checking whether we have permission to cd to a directory #[derive(Debug)] pub enum PermissionResult { PermissionOk, PermissionDenied, } // TODO: Maybe we should use file_attributes() from http...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/nu_cow.rs
crates/nu-utils/src/nu_cow.rs
use std::fmt::Debug; use serde::{Deserialize, Serialize}; #[derive(Serialize)] #[serde(untagged)] #[allow(dead_code)] pub enum NuCow<B, O> { Borrowed(B), Owned(O), } impl<B, O> PartialEq for NuCow<B, O> where O: std::cmp::PartialEq<O>, B: std::cmp::PartialEq<B>, O: std::cmp::PartialEq<B>, { f...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/utils.rs
crates/nu-utils/src/utils.rs
#[cfg(windows)] use crossterm_winapi::{ConsoleMode, Handle}; use lscolors::LsColors; use std::{ fmt::Display, io::{self, Result, Write}, }; pub fn enable_vt_processing() -> Result<()> { #[cfg(windows)] { let console_out_mode = ConsoleMode::from(Handle::current_out_handle()?); let old_ou...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/emoji.rs
crates/nu-utils/src/emoji.rs
pub fn contains_emoji(val: &str) -> bool { // Let's do some special handling for emojis const ZERO_WIDTH_JOINER: &str = "\u{200d}"; const VARIATION_SELECTOR_16: &str = "\u{fe0f}"; const SKIN_TONES: [&str; 5] = [ "\u{1f3fb}", // Light Skin Tone "\u{1f3fc}", // Medium-Light Skin Tone ...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/shared_cow.rs
crates/nu-utils/src/shared_cow.rs
use serde::{Deserialize, Serialize}; use std::{fmt, ops, sync::Arc}; /// A container that transparently shares a value when possible, but clones on mutate. /// /// Unlike `Arc`, this is only intended to help save memory usage and reduce the amount of effort /// required to clone unmodified values with easy to use copy...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/float.rs
crates/nu-utils/src/float.rs
use std::fmt::{Display, LowerExp}; /// A f64 wrapper that formats whole numbers with a decimal point. pub struct ObviousFloat(pub f64); impl Display for ObviousFloat { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { let val = self.0; if val.fract() == 0.0 { write!(f, "...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/casing.rs
crates/nu-utils/src/casing.rs
use std::cmp::Ordering; use unicase::UniCase; pub trait IgnoreCaseExt { /// Returns a [case folded] equivalent of this string, as a new String. /// /// Case folding is primarily based on lowercase mapping, but includes /// additional changes to the source text to help make case folding /// language...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/split_read.rs
crates/nu-utils/src/split_read.rs
use std::io::{BufRead, ErrorKind}; use memchr::memmem::Finder; pub struct SplitRead<R> { reader: Option<R>, buf: Option<Vec<u8>>, finder: Finder<'static>, } impl<R: BufRead> SplitRead<R> { pub fn new(reader: R, delim: impl AsRef<[u8]>) -> Self { // empty delimiter results in an infinite strea...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/flatten_json.rs
crates/nu-utils/src/flatten_json.rs
use serde_json::{Map, Value as SerdeValue, json}; /// JsonFlattener is the main driver when flattening JSON /// # Examples /// ``` /// use nu_utils; /// /// let flattener = nu_utils::JsonFlattener { ..Default::default() }; /// ``` pub struct JsonFlattener<'a> { /// Alternate separator used between keys when flatte...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/main.rs
crates/nu-utils/src/main.rs
#[cfg(windows)] use nu_utils::utils::enable_vt_processing; fn main() { // reset vt processing, aka ansi because illbehaved externals can break it #[cfg(windows)] { let _ = enable_vt_processing(); } }
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/deansi.rs
crates/nu-utils/src/deansi.rs
use std::borrow::Cow; /// Removes ANSI escape codes and some ASCII control characters /// /// Optimized for strings that rarely contain ANSI control chars. /// Uses fast search to avoid reallocations. /// /// Keeps `\n` removes `\r`, `\t` etc. /// /// If parsing fails silently returns the input string pub fn strip_ans...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/quoting.rs
crates/nu-utils/src/quoting.rs
use fancy_regex::Regex; use std::sync::LazyLock; // This hits, in order: // • Any character of []:`{}#'";()|$,.!?= // • Any digit (\d) // • Any whitespace (\s) // • Case-insensitive sign-insensitive float "keywords" inf, infinity and nan. static NEEDS_QUOTING_REGEX: LazyLock<Regex> = LazyLock::new(|| { Regex::new(...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/locale.rs
crates/nu-utils/src/locale.rs
use num_format::Locale; pub const LOCALE_OVERRIDE_ENV_VAR: &str = "NU_TEST_LOCALE_OVERRIDE"; pub fn get_system_locale() -> Locale { let locale_string = get_system_locale_string().unwrap_or_else(|| String::from("en-US")); // Since get_locale() and Locale::from_name() don't always return the same items // w...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/strings/unique.rs
crates/nu-utils/src/strings/unique.rs
use std::{ borrow::Borrow, fmt::{Arguments, Debug, Display}, hash::Hash, ops::Deref, }; use serde::{Deserialize, Serialize}; /// An owned, immutable string with compact storage. /// /// `UniqueString` is designed for immutable strings that are not frequently cloned and hold ownership. /// It offers si...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/strings/mod.rs
crates/nu-utils/src/strings/mod.rs
//! String utility types with specific semantics. //! //! This module provides additional string types optimized for certain use-cases, offering //! alternatives to standard [`String`] or [`&str`](str) when specific performance characteristics //! are desired. //! //! The pipeline-based, functional programming model, w...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-utils/src/strings/shared.rs
crates/nu-utils/src/strings/shared.rs
use std::{ borrow::Borrow, fmt::{Arguments, Debug, Display}, hash::Hash, ops::Deref, }; use serde::{Deserialize, Serialize}; /// An owned, immutable string with compact storage and efficient cloning. /// /// `SharedString` is designed for immutable strings that are frequently cloned and hold ownership...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-experimental/src/lib.rs
crates/nu-experimental/src/lib.rs
//! Experimental Options for the Nu codebase. //! //! This crate defines all experimental options used in Nushell. //! //! An [`ExperimentalOption`] is basically a fancy global boolean. //! It should be set very early during initialization and lets us switch between old and new //! behavior for parts of the system. //!...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-experimental/src/parse.rs
crates/nu-experimental/src/parse.rs
use crate::{ALL, ExperimentalOption, Status}; use itertools::Itertools; use std::{borrow::Cow, env, ops::Range, sync::atomic::Ordering}; use thiserror::Error; /// Environment variable used to load experimental options from. /// /// May be used like this: `NU_EXPERIMENTAL_OPTIONS=example nu`. pub const ENV: &str = "NU_...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-experimental/src/util.rs
crates/nu-experimental/src/util.rs
use std::sync::atomic::{AtomicU8, Ordering}; /// Store an `Option<bool>` as an atomic. /// /// # Implementation Detail /// This stores the `Option<bool>` via its three states as `u8` representing: /// - `None` as `0` /// - `Some(true)` as `1` /// - `Some(false)` as `2` pub struct AtomicMaybe(AtomicU8); impl AtomicMay...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-experimental/src/options/pipefail.rs
crates/nu-experimental/src/options/pipefail.rs
use crate::*; /// Enable pipefail feature to ensure that the exit status of a pipeline /// accurately reflects the success or failure of all commands within that pipeline, not just /// the last one. /// /// So it helps user writing more rubost nushell script. pub static PIPE_FAIL: ExperimentalOption = ExperimentalOpti...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-experimental/src/options/enforce_runtime_annotations.rs
crates/nu-experimental/src/options/enforce_runtime_annotations.rs
use crate::*; /// Enable runtime type annotation feature to ensure that type annotations /// are checked against the type that binds to them, returning conversion errors /// if the types are incompatible. pub static ENFORCE_RUNTIME_ANNOTATIONS: ExperimentalOption = ExperimentalOption::new(&EnforceRuntimeAnnotation...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-experimental/src/options/example.rs
crates/nu-experimental/src/options/example.rs
use crate::*; /// Example experimental option. /// /// This shows how experimental options should be implemented and documented. /// Reading this static's documentation alone should clearly explain what the /// option changes and how it interacts with the rest of the codebase. /// /// Use this pattern when adding real...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-experimental/src/options/mod.rs
crates/nu-experimental/src/options/mod.rs
#![allow( private_interfaces, reason = "The marker structs don't need to be exposed, only the static values." )] use crate::*; mod enforce_runtime_annotations; mod example; mod pipefail; mod reorder_cell_paths; pub(crate) type Version = (u16, u16, u16); /// Marker trait for defining experimental options. //...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
nushell/nushell
https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-experimental/src/options/reorder_cell_paths.rs
crates/nu-experimental/src/options/reorder_cell_paths.rs
use crate::*; /// Reorder cell-path members in `Value::follow_cell_path` to decrease memory usage. /// /// - Accessing a field in a record is cheap, just a simple search and you get a reference to the /// value. /// - Accessing an row in a list is even cheaper, just an array access and you get a reference to /// t...
rust
MIT
6d3cb27fa40b324a1168c577aee7f3532a5e157e
2026-01-04T15:32:17.606688Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/build.rs
build.rs
use std::fs; use clap_complete::{generate_to, Shell}; include!("src/cli.rs"); fn main() { let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR")); let outdir = match var { None => return, Some(outdir) => outdir, }; fs::create_dir_all(&outdir).unwrap...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/command.rs
src/command.rs
use std::collections::BTreeMap; use std::fmt; use std::str::FromStr; use crate::parameter::tokenize::tokenize; use crate::parameter::ParameterValue; use crate::{ error::{OptionsError, ParameterScanError}, parameter::{ range_step::{Numeric, RangeStep}, ParameterNameAndValue, }, }; use clap:...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/cli.rs
src/cli.rs
use std::ffi::OsString; use clap::{ builder::NonEmptyStringValueParser, crate_version, Arg, ArgAction, ArgMatches, Command, ValueHint, }; pub fn get_cli_arguments<'a, I, T>(args: I) -> ArgMatches where I: IntoIterator<Item = T>, T: Into<OsString> + Clone + 'a, { let command = build_command(); ...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/error.rs
src/error.rs
use std::num::{self, ParseFloatError, ParseIntError}; use rust_decimal::Error as DecimalError; use thiserror::Error; #[derive(Debug, Error)] pub enum ParameterScanError { #[error("Error while parsing parameter scan arguments ({0})")] ParseIntError(num::ParseIntError), #[error("Error while parsing paramete...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/options.rs
src/options.rs
use std::fs::File; use std::io::IsTerminal; use std::path::PathBuf; use std::process::{Command, Stdio}; use std::{cmp, env, fmt, io}; use anyhow::ensure; use clap::ArgMatches; use crate::command::Commands; use crate::error::OptionsError; use crate::util::units::{Second, Unit}; use anyhow::Result; #[cfg(not(windows)...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/outlier_detection.rs
src/outlier_detection.rs
//! A module for statistical outlier detection. //! //! References: //! - Boris Iglewicz and David Hoaglin (1993), "Volume 16: How to Detect and Handle Outliers", //! The ASQC Basic References in Quality Control: Statistical Techniques, Edward F. Mykytka, //! Ph.D., Editor. use statistical::median; /// Minimum mo...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/main.rs
src/main.rs
#![cfg_attr( all(windows, feature = "windows_process_extensions_main_thread_handle"), feature(windows_process_extensions_main_thread_handle) )] use std::env; use benchmark::scheduler::Scheduler; use cli::get_cli_arguments; use command::Commands; use export::ExportManager; use options::Options; use anyhow::Re...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/util/number.rs
src/util/number.rs
use std::convert::TryFrom; use std::fmt; use rust_decimal::prelude::ToPrimitive; use rust_decimal::Decimal; use serde::Serialize; #[derive(Debug, Clone, Serialize, Copy, PartialEq, Eq)] #[serde(untagged)] pub enum Number { Int(i32), Decimal(Decimal), } impl fmt::Display for Number { fn fmt(&self, f: &mut...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/util/units.rs
src/util/units.rs
//! This module contains common units. pub type Scalar = f64; /// Type alias for unit of time pub type Second = Scalar; /// Supported time units #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Unit { Second, MilliSecond, MicroSecond, } impl Unit { /// The abbreviation of the Unit. pub fn s...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/util/exit_code.rs
src/util/exit_code.rs
use std::process::ExitStatus; #[cfg(unix)] pub fn extract_exit_code(status: ExitStatus) -> Option<i32> { use std::os::unix::process::ExitStatusExt; // From the ExitStatus::code documentation: // // "On Unix, this will return None if the process was terminated by a signal." // // In that case...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/util/mod.rs
src/util/mod.rs
pub mod exit_code; pub mod min_max; pub mod number; pub mod randomized_environment_offset; pub mod units;
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/util/min_max.rs
src/util/min_max.rs
/// A max function for f64's without NaNs pub fn max(vals: &[f64]) -> f64 { *vals .iter() .max_by(|a, b| a.partial_cmp(b).unwrap()) .unwrap() } /// A min function for f64's without NaNs pub fn min(vals: &[f64]) -> f64 { *vals .iter() .min_by(|a, b| a.partial_cmp(b).unwra...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/util/randomized_environment_offset.rs
src/util/randomized_environment_offset.rs
/// Returns a string with a random length. This value will be set as an environment /// variable to account for offset effects. See [1] for more details. /// /// [1] Mytkowicz, 2009. Producing Wrong Data Without Doing Anything Obviously Wrong!. /// Sigplan Notices - SIGPLAN. 44. 265-276. 10.1145/1508284.1508275. pu...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/benchmark/relative_speed.rs
src/benchmark/relative_speed.rs
use std::cmp::Ordering; use super::benchmark_result::BenchmarkResult; use crate::{options::SortOrder, util::units::Scalar}; #[derive(Debug)] pub struct BenchmarkResultWithRelativeSpeed<'a> { pub result: &'a BenchmarkResult, pub relative_speed: Scalar, pub relative_speed_stddev: Option<Scalar>, pub is_...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/benchmark/timing_result.rs
src/benchmark/timing_result.rs
use crate::util::units::Second; /// Results from timing a single command #[derive(Debug, Default, Copy, Clone)] pub struct TimingResult { /// Wall clock time pub time_real: Second, /// Time spent in user mode pub time_user: Second, /// Time spent in kernel mode pub time_system: Second, /...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/benchmark/executor.rs
src/benchmark/executor.rs
#[cfg(windows)] use std::os::windows::process::CommandExt; use std::process::ExitStatus; use crate::command::Command; use crate::options::{ CmdFailureAction, CommandInputPolicy, CommandOutputPolicy, Options, OutputStyleOption, Shell, }; use crate::output::progress_bar::get_progress_bar; use crate::timer::{execute_...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/benchmark/mod.rs
src/benchmark/mod.rs
pub mod benchmark_result; pub mod executor; pub mod relative_speed; pub mod scheduler; pub mod timing_result; use std::cmp; use crate::benchmark::executor::BenchmarkIteration; use crate::command::Command; use crate::options::{ CmdFailureAction, CommandOutputPolicy, ExecutorKind, Options, OutputStyleOption, }; use...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/benchmark/benchmark_result.rs
src/benchmark/benchmark_result.rs
use std::collections::BTreeMap; use serde::Serialize; use crate::util::units::Second; /// Set of values that will be exported. // NOTE: `serde` is used for JSON serialization, but not for CSV serialization due to the // `parameters` map. Update `src/hyperfine/export/csv.rs` with new fields, as appropriate. #[derive(...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/benchmark/scheduler.rs
src/benchmark/scheduler.rs
use super::benchmark_result::BenchmarkResult; use super::executor::{Executor, MockExecutor, RawExecutor, ShellExecutor}; use super::{relative_speed, Benchmark}; use colored::*; use std::cmp::Ordering; use crate::command::{Command, Commands}; use crate::export::ExportManager; use crate::options::{ExecutorKind, Options,...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false