Skip to main content

merge_from_string

Function merge_from_string 

Source
pub fn merge_from_string(s: &str) -> Result<WisdomMergeResult, WisdomError>
Expand description

Merge incoming wisdom into the global cache.

For each entry in the incoming wisdom string:

  • If the problem hash is not yet in the global cache, it is inserted.
  • If it is already present and the incoming cost is lower, the existing entry is replaced.
  • Otherwise the existing entry is kept.

§Errors

Returns an error if the wisdom string is structurally unrecognisable or its format_version is newer than WISDOM_FORMAT_VERSION.

§Example

use oxifft::api::{export_to_string, merge_from_string, forget};

forget();
let wisdom = export_to_string();
let result = merge_from_string(&wisdom).unwrap();
assert_eq!(result.added, 0);