Skip to main content

Options

Struct Options 

Source
pub struct Options { /* private fields */ }
Expand description

节点参数(YAML 的 options 子树)。支持点号路径与数组。

Implementations§

Source§

impl Options

Source

pub fn new(root: Value) -> Self

Source

pub fn get(&self, path: &str) -> Option<&Value>

按点号路径取值:"roi.x" → root["roi"]["x"]。

Source

pub fn has(&self, path: &str) -> bool

Source

pub fn i64(&self, path: &str) -> Option<i64>

Source

pub fn f64(&self, path: &str) -> Option<f64>

Source

pub fn bool(&self, path: &str) -> Option<bool>

Source

pub fn str(&self, path: &str) -> Option<&str>

Source

pub fn str_cstr(&self, path: &str) -> Option<*const c_char>

字符串参数的 C 指针(生命周期随 graph)。

Source

pub fn seq(&self, path: &str) -> Option<&Vec<Value>>

Source

pub fn count(&self, path: &str) -> usize

Source

pub fn i64_array(&self, path: &str, out: &mut [i64]) -> usize

Source

pub fn f64_array(&self, path: &str, out: &mut [f64]) -> usize

Source

pub fn str_array(&self, path: &str, out: &mut [*const c_char]) -> usize

Source

pub fn json(&self) -> &str

Source

pub fn json_cstr(&self) -> *const c_char

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.