Struct oxyroot::Slice

source ·
pub struct Slice<T> { /* private fields */ }
Expand description

Represent a array of T* in C++

To read branch with int (aka i32 rust) in it

use oxyroot::RootFile;

let s = "examples/from_uproot/data/small-evnt-tree-fullsplit.root";///
let mut f = RootFile::open(s).unwrap();
let tree = f.get_tree("tree").unwrap();

tree.branch("SliceI16")
        .unwrap()
        .as_iter::<oxyroot::Slice<i16>>().expect("wrong type")
        .map(|a| a.into_vec())
        .enumerate()
        .for_each(|(i, val)| {
            assert_eq!(val.len(), i % 10);

            val.into_iter()
                .map(|v| {
                    assert_eq!(v, i as i16);
                })
                .for_each(drop) // Consume iterator
        });

Implementations§

source§

impl<T> Slice<T>

source

pub fn into_vec(self) -> Vec<T>

source

pub fn inner(&self) -> &Vec<T>

Trait Implementations§

source§

impl<T: Debug> Debug for Slice<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Default> Default for Slice<T>

source§

fn default() -> Slice<T>

Returns the “default value” for a type. Read more
source§

impl<T> From<Slice<T>> for Vec<T>

source§

fn from(slice: Slice<T>) -> Self

Converts to this type from the input type.
source§

impl<T> Unmarshaler for Slice<T>
where T: UnmarshalerInto<Item = T> + Debug,

source§

fn unmarshal(&mut self, r: &mut RBuffer<'_>) -> Result<(), Error>

source§

fn class_name() -> Option<Vec<String>>
where Self: Sized,

Returns the kind of the type as C++ typename. Used to check if the type is supported.

Auto Trait Implementations§

§

impl<T> Freeze for Slice<T>

§

impl<T> RefUnwindSafe for Slice<T>
where T: RefUnwindSafe,

§

impl<T> Send for Slice<T>
where T: Send,

§

impl<T> Sync for Slice<T>
where T: Sync,

§

impl<T> Unpin for Slice<T>
where T: Unpin,

§

impl<T> UnwindSafe for Slice<T>
where T: UnwindSafe,

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> Any for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

source§

fn type_name(&self) -> &'static str

source§

impl<T> AnySync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

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<'a, T> ReadFromTree<'a> for T
where T: UnmarshalerInto<Item = T> + 'a,

source§

fn from_branch_tree( tree: &'a Tree<Branch>, branch_name: BranchName ) -> Result<impl Iterator<Item = T>, Error>

source§

fn from_tree(tree: &'a ReaderTree) -> Result<impl Iterator<Item = Self>>
where Self: Sized,

source§

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

§

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>,

§

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.
source§

impl<T> UnmarshalerInto for T
where T: Default + Unmarshaler,

§

type Item = T

source§

fn unmarshal_into( r: &mut RBuffer<'_> ) -> Result<<T as UnmarshalerInto>::Item, Error>

source§

fn classe_name() -> Option<Vec<String>>