pub struct SymbolSet {
pub symbol_ids: Vec<String>,
}Expand description
SymbolSet - a collection of SymbolIds for filtering search results.
This type represents a set of symbols identified by their 32-character BLAKE3 hash SymbolIds. It can be loaded from JSON files or extracted from Magellan algorithm outputs.
§JSON Format
{
"symbol_ids": [
"abc123def456789012345678901234ab",
"def456789012345678901234abcd1234",
...
]
}§Example
use llmgrep::algorithm::SymbolSet;
use std::path::Path;
let symbol_set = SymbolSet::from_file(Path::new("symbols.json"))?;
symbol_set.validate()?;Fields§
§symbol_ids: Vec<String>List of SymbolIds (32-char BLAKE3 hashes)
Implementations§
Source§impl SymbolSet
impl SymbolSet
Sourcepub fn from_file(path: &Path) -> Result<Self, LlmError>
pub fn from_file(path: &Path) -> Result<Self, LlmError>
Load SymbolSet from a JSON file.
§Arguments
path- Path to the JSON file containing SymbolSet data
§Returns
A validated SymbolSet if the file exists and contains valid JSON.
§Errors
Returns LlmError::IoError if the file cannot be read.
Returns LlmError::JsonError if the JSON is invalid or malformed.
§Example
use llmgrep::algorithm::SymbolSet;
use std::path::Path;
let symbol_set = SymbolSet::from_file(Path::new("reachable.json"))?;Sourcepub fn validate(&self) -> Result<(), LlmError>
pub fn validate(&self) -> Result<(), LlmError>
Validate that all SymbolIds are in the correct format (32 hex characters).
Magellan SymbolIds are 32-character BLAKE3 hashes represented as lowercase hexadecimal strings. This method validates that format.
§Returns
Ok(()) if all SymbolIds are valid.
§Errors
Returns LlmError::InvalidQuery if any SymbolId has an invalid format.
§Example
use llmgrep::algorithm::SymbolSet;
let symbol_set = SymbolSet {
symbol_ids: vec![
"abc123def456789012345678901234ab".to_string(),
],
};
assert!(symbol_set.validate().is_ok());Trait Implementations§
Source§impl<'de> Deserialize<'de> for SymbolSet
impl<'de> Deserialize<'de> for SymbolSet
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>,
Auto Trait Implementations§
impl Freeze for SymbolSet
impl RefUnwindSafe for SymbolSet
impl Send for SymbolSet
impl Sync for SymbolSet
impl Unpin for SymbolSet
impl UnwindSafe for SymbolSet
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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