Skip to main content

style_table

Struct style_table 

Source
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

Source

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.

Source

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.

Source

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.

Source

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”.

Source

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).

Source

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).

Source

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).

Source

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).

Source

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).

Source

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.

Source

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

Source§

fn default() -> style_table

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more