DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/RPC/CocoonService/TreeView/ViewIdHandle.rs
1//! Hash a `viewId` string into the same `u32` that
2//! `RegisterTreeViewProvider::Fn` uses as a registration handle. Lets
3//! `GetTreeChildren::Fn` look up the registered provider without the
4//! caller passing the handle through the wire.
5
6pub fn Fn(ViewIdentifier:&str) -> u32 {
7 ViewIdentifier
8 .as_bytes()
9 .iter()
10 .fold(0u32, |Acc, B| Acc.wrapping_mul(31).wrapping_add(*B as u32))
11}