pub struct style_table { /* private fields */ }Expand description
zstyle storage table.
Port of the zstyletab HashTable Src/Modules/zutil.c builds —
newzstyletable() (line 270) creates it, bin_zstyle()
(line 487) drives every mutation. Stores stypat entries
(port of C struct stypat, zutil.c:95) per style name,
weight-sorted so the most specific pattern wins.
style_table — see fields for layout.
Implementations§
Source§impl style_table
impl style_table
Sourcepub fn new() -> Self
pub fn new() -> Self
WARNING: NOT IN ZUTIL.C — method on Rust-only style_table wrapper.
C inlines this pattern at every callsite; Rust factors it onto the wrapper.
Sourcepub fn set(
&mut self,
pattern: &str,
style: &str,
values: Vec<String>,
eval_prog: Option<Eprog>,
)
pub fn set( &mut self, pattern: &str, style: &str, values: Vec<String>, eval_prog: Option<Eprog>, )
Port of setstypat(Style s, char *pat, Patprog prog, char **vals, int eval) from Src/Modules/zutil.c:295.
Insert or replace a pattern→values mapping for a style.
Mirrors Src/Modules/zutil.c:295 setstypat + c:403 addstyle
— find or create the style’s pats list, replace if pattern
already present, else insert in weight-descending order.
Sourcepub fn get(&self, context: &str, style: &str) -> Option<&[String]>
pub fn get(&self, context: &str, style: &str) -> Option<&[String]>
Port of bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) from Src/Modules/zutil.c:487.
Look up the values for (context, style). Mirrors
Src/Modules/zutil.c:443 lookupstyle — walk the style’s pats
list, return values from the first weight-sorted entry whose
pat matches the context.
Sourcepub fn get_exact(&self, pattern: &str, style: &str) -> Option<&[String]>
pub fn get_exact(&self, pattern: &str, style: &str) -> Option<&[String]>
c:Src/Modules/zutil.c:768-779 — bin_zstyle -g retrieval. Unlike
lookupstyle/get (which pattry-match the CONTEXT against every
stored pattern), -g does an EXACT pattern-string compare
(if (!strcmp(args[2], p->pat))). So after zstyle ':s:*' k v,
zstyle -g out ':s:sub' k returns NOTHING (“:s:sub” != “:s:*”),
whereas zstyle -s ':s:sub' k out matches and yields “v”.
Sourcepub fn get_match(
&self,
context: &str,
style: &str,
) -> Option<(Vec<String>, bool)>
pub fn get_match( &self, context: &str, style: &str, ) -> Option<(Vec<String>, bool)>
WARNING: NOT IN ZUTIL.C — method on the Rust-only style_table
wrapper. Same best-pattern-match walk as get, but returns the
matched entry’s values AND whether it is an -e (eval) style, so
lookupstyle can decide to execute the body (C reads the matched
Stypat’s eval field inline; the wrapper keeps the map private).
Sourcepub fn delete(&mut self, pattern: Option<&str>, style: Option<&str>)
pub fn delete(&mut self, pattern: Option<&str>, style: Option<&str>)
WARNING: NOT IN ZUTIL.C — method on Rust-only style_table wrapper.
C inlines this pattern at every callsite; Rust factors it onto the wrapper.
Remove style/pattern entries from the table. Mirrors the
-d dispatch arms of bin_zstyle (Src/Modules/zutil.c:487).
Sourcepub fn list(&self, context: Option<&str>) -> Vec<(String, String, Vec<String>)>
pub fn list(&self, context: Option<&str>) -> Vec<(String, String, Vec<String>)>
Port of setstypat(Style s, char *pat, Patprog prog, char **vals, int eval) from Src/Modules/zutil.c:295.
Return (pattern, style, values) triples for zstyle -L /
zstyle -a listing. Mirrors bin_zstyle list dispatch
(Src/Modules/zutil.c:487 -L/-a arms).
Sourcepub fn list_styles(&self) -> Vec<&str>
pub fn list_styles(&self) -> Vec<&str>
WARNING: NOT IN ZUTIL.C — method on Rust-only style_table wrapper.
C inlines this pattern at every callsite; Rust factors it onto the wrapper.
List all registered style names (bin_zstyle -g without args).
Sourcepub fn list_patterns(&self) -> Vec<&str>
pub fn list_patterns(&self) -> Vec<&str>
WARNING: NOT IN ZUTIL.C — method on Rust-only style_table wrapper.
C inlines this pattern at every callsite; Rust factors it onto the wrapper.
List all distinct patterns across every style (bin_zstyle -g
with a single pattern arg).
Sourcepub fn test(&self, context: &str, style: &str, values: Option<&[&str]>) -> bool
pub fn test(&self, context: &str, style: &str, values: Option<&[&str]>) -> bool
WARNING: NOT IN ZUTIL.C — method on Rust-only style_table wrapper.
C inlines this pattern at every callsite; Rust factors it onto the wrapper.
Boolean-truthy zstyle -T / zstyle -t check.
Mirrors bin_zstyle -t / -T arms in Src/Modules/zutil.c:487.
Sourcepub fn test_bool(&self, context: &str, style: &str) -> Option<bool>
pub fn test_bool(&self, context: &str, style: &str) -> Option<bool>
WARNING: NOT IN ZUTIL.C — method on Rust-only style_table wrapper.
C inlines this pattern at every callsite; Rust factors it onto the wrapper.
Single-value “yes/no” interrogation of a style. The bin_zstyle
-b arm of Src/Modules/zutil.c:487.
Trait Implementations§
Source§impl Default for style_table
impl Default for style_table
Source§fn default() -> style_table
fn default() -> style_table
Auto Trait Implementations§
impl Freeze for style_table
impl RefUnwindSafe for style_table
impl Send for style_table
impl Sync for style_table
impl Unpin for style_table
impl UnsafeUnpin for style_table
impl UnwindSafe for style_table
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more