mirror of
https://github.com/nushell/nushell
synced 2025-01-14 22:24:54 +00:00
ec528c0626
# Description Get rid of two parallel `Vec`s in `StateDelta` and `EngineState`, that also duplicated span information. Use a struct with documenting fields. Also use `Arc<str>` and `Arc<[u8]>` for the allocations as they are never modified and cloned often (see #12229 for the first improvement). This also makes the representation more compact as no capacity is necessary. # User-Facing Changes API breakage on `EngineState`/`StateWorkingSet`/`StateDelta` that should not really affect plugin authors.
15 lines
506 B
Rust
15 lines
506 B
Rust
use crate::Span;
|
|
use std::sync::Arc;
|
|
|
|
/// Unit of cached source code
|
|
#[derive(Clone)]
|
|
pub struct CachedFile {
|
|
// Use Arcs of slice types for more compact representation (capacity less)
|
|
// Could possibly become an `Arc<PathBuf>`
|
|
/// The file name with which the code is associated (also includes REPL input)
|
|
pub name: Arc<str>,
|
|
/// Source code as raw bytes
|
|
pub content: Arc<[u8]>,
|
|
/// global span coordinates that are covered by this [`CachedFile`]
|
|
pub covered_span: Span,
|
|
}
|