Skip to main content

dispatch_storage

Macro dispatch_storage 

Source
macro_rules! dispatch_storage {
    ($s:expr, $name:ident => $body:expr) => { ... };
}
Expand description

Feature-aware match over BackendStorage variants. Used wherever the dispatch shape match s { Cpu(...) => ..., Cuda(...) => ... } would otherwise need #[cfg(feature = "...")] arms inline.

fn len_bytes(s: &BackendStorage) -> usize {
    dispatch_storage!(s, inner => inner.len_bytes())
}