fn link(
        &mut self,
        obj: &Self::Id,
        owner: &Self::Id,
        nth: usize,
    ) -> Result<(), FlowError> {
        if !self.contains_node(obj) {
            Err(FlowError::NotExistObj)?
        }
        let res = self
            .node_mut(owner)
            .map(|owner| {
                if owner.children().contains(obj) {
                    return Ok(());
                    // owner.children_ref_mut().retain(|id| id != obj)
                }
                if nth > owner.children().len() {
                    Err(FlowError::InvalidLen)?
                }
                owner.children_ref_mut().insert(nth, obj.clone());
                Ok(())
            })
            .unwrap_or(Err(FlowError::NotExistOwner));
        self.check_assert();
        res
    }
/// randomly ensures the link of a node to another; won't change if aleady has the node as child
randomly ensures the link of a node to another; won't change if aleady has the node as child
randomly ensures the link of a node to another ; won ' t change if aleady has the node as child
fn link(
        &mut self,
        obj: &Self::Id,
        owner: &Self::Id,
        nth: usize,
    ) -> Result<(), FlowError> {
        if !self.contains_node(obj) {
            Err(FlowError::NotExistObj)?
        }
        let res = self
            .node_mut(owner)
            .map(|owner| {
                if owner.children().contains(obj) {
                    return Ok(());
                    // owner.children_ref_mut().retain(|id| id != obj)
                }
                if nth > owner.children().len() {
                    Err(FlowError::InvalidLen)?
                }
                owner.children_ref_mut().insert(nth, obj.clone());
                Ok(())
            })
            .unwrap_or(Err(FlowError::NotExistOwner));
        self.check_assert();
        res
    }
fn link ( & mut self , obj : & Self :: Id , owner : & Self :: Id , nth : usize , ) -> Result < ( ) , FlowError > { if ! self . contains_node ( obj ) { Err ( FlowError :: NotExistObj ) ? } let res = self . node_mut ( owner ) . map ( | owner | { if owner . children ( ) . contains ( obj ) { return Ok ( ( ) ) ; // owner.children_ref_mut().retain(|id| id != obj) } if nth > owner . children ( ) . len ( ) { Err ( FlowError :: InvalidLen ) ? } owner . children_ref_mut ( ) . insert ( nth , obj . clone ( ) ) ; Ok ( ( ) ) } ) . unwrap_or ( Err ( FlowError :: NotExistOwner ) ) ; self . check_assert ( ) ; res }
randomly ensures the link of a node to another; won't change if aleady has the node as child
randomly ensures the link of a node to another ; won ' t change if aleady has the node as child
&mut self
obj
&Self::Id
owner
&Self::Id
nth
usize
&mut self
obj
&Self::Id
owner
&Self::Id
nth
usize