append_patterns

Function append_patterns 

Source
pub fn append_patterns(
    patterns: &[SignificantPattern],
    path: &Path,
) -> Result<()>
Expand description

Append new patterns to an existing patterns file

This is more efficient than loading all patterns, adding new ones, and saving the entire list. However, it only works with uncompressed JSON arrays.

§Arguments

  • patterns - New patterns to append
  • path - Path to the existing patterns file

§Note

If the file doesn’t exist, it will be created with the given patterns. For compressed files, this will decompress, append, and recompress.

§Example

let new_patterns: Vec<SignificantPattern> = vec![];
append_patterns(&new_patterns, Path::new("patterns.json"))?;