pub struct RuntimeCapabilities {
pub build: Option<u32>,
pub commit: Option<String>,
pub version_line: String,
pub flags: RuntimeFlags,
}Expand description
What the llama-server binary underneath gglib is, and what it can do.
Fields§
§build: Option<u32>llama.cpp build number (the 9656 of tag b9656), when it could be
determined.
None for a binary whose version output this module does not
recognise — a source build with a modified banner, a wrapper script, a
future format — and for an unnumbered source build, whose sentinel 1
is rejected by MIN_PLAUSIBLE_BUILD. Recorded rather than guessed.
commit: Option<String>The commit sha the banner reported, when it carried one.
For a numbered release this is redundant with Self::build. For an
unnumbered source build it is the only identity available, which is
why it is captured separately rather than left inside
Self::version_line: a stored request record naming a sha can be
resolved against upstream history later, and one naming version: 1
cannot.
version_line: StringThe raw version line as the binary reported it.
Kept verbatim even when Self::build parsed cleanly, because it is
the only artifact that lets a stored request record be re-interpreted
after this module learns to read a format it could not read before.
flags: RuntimeFlagsCapabilities derived from Self::build.
Implementations§
Source§impl RuntimeCapabilities
impl RuntimeCapabilities
Sourcepub fn unknown(version_line: impl Into<String>) -> Self
pub fn unknown(version_line: impl Into<String>) -> Self
An unidentified runtime: no build, no flags, every compensation on.
Sourcepub fn from_build(build: u32, version_line: impl Into<String>) -> Self
pub fn from_build(build: u32, version_line: impl Into<String>) -> Self
Derive capabilities from a build number.
The single place a build number becomes a capability set, so a threshold is stated once and every caller agrees about it.
A build under MIN_PLAUSIBLE_BUILD is an unnumbered source build and
yields Self::unknown — the conservative answer, and the only honest
one, since such a binary could be any commit at all.
Sourcepub fn from_version_output(output: &str) -> Self
pub fn from_version_output(output: &str) -> Self
Parse a llama-server version banner into capabilities, falling back to
Self::unknown when no build number can be read.
Sourcepub const fn has(&self, flag: RuntimeFlags) -> bool
pub const fn has(&self, flag: RuntimeFlags) -> bool
Whether this runtime has flag.
Always false for an unidentified runtime, which is what keeps
“unknown” and “absent” behaving identically at call sites without every
call site having to remember the distinction.
Sourcepub const fn is_identified(&self) -> bool
pub const fn is_identified(&self) -> bool
Whether the runtime was identified at all.
Trait Implementations§
Source§impl Clone for RuntimeCapabilities
impl Clone for RuntimeCapabilities
Source§fn clone(&self) -> RuntimeCapabilities
fn clone(&self) -> RuntimeCapabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuntimeCapabilities
impl Debug for RuntimeCapabilities
Source§impl<'de> Deserialize<'de> for RuntimeCapabilities
impl<'de> Deserialize<'de> for RuntimeCapabilities
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RuntimeCapabilities
impl PartialEq for RuntimeCapabilities
Source§fn eq(&self, other: &RuntimeCapabilities) -> bool
fn eq(&self, other: &RuntimeCapabilities) -> bool
self and other values to be equal, and is used by ==.