[][src]Macro partial_ref::split_borrow

macro_rules! split_borrow {
    ($target:ident = &($($parts:tt)*) $from:ident) => { ... };
    ($target:ident, $rest:ident = &($($parts:tt)*) $from:expr) => { ... };
}

Helper macro for splitting a partial reference.

The statement split_borrow!(target, rest = &(...) expr) where ... is a list of parts (same syntax as used for partial) splits the partial reference returned by expr and binds the listed parts to the identifier target and the remaining parts to the identifier rest. This is done using [PartialRef]'s split_borrow method.

As shorter version is available as split_borrow!(target = &(...) ident) which is identical to split_borrow!(target, ident = &(...) ident). This shadows the existing partial reference with a new binding.