Skip to main content

with_safe_locale

Function with_safe_locale 

Source
pub fn with_safe_locale<T>(f: impl FnOnce() -> T) -> Result<T>
Expand description

Runs f with the "C" numeric locale in effect, see SafeLocale.

§Errors

The errors of SafeLocale::enter; f’s own result is returned inside the Ok.

use igraph::{foreign::with_safe_locale, prelude::*};
let g = with_safe_locale(|| Graph::read_graph_edgelist_from_str("0 1", 0, false)).unwrap().unwrap();
assert_eq!(g.ecount(), 1);