caps: Add a helper constructor for Caps.
This commit is contained in:
parent
ede2b08039
commit
b936ce595f
1 changed files with 11 additions and 0 deletions
11
src/caps.rs
11
src/caps.rs
|
@ -71,6 +71,17 @@ impl From<Caps> for Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Caps {
|
||||||
|
/// Create a Caps element from its node and hash.
|
||||||
|
pub fn new<N: Into<String>>(node: N, hash: Hash) -> Caps {
|
||||||
|
Caps {
|
||||||
|
ext: None,
|
||||||
|
node: node.into(),
|
||||||
|
hash,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn compute_item(field: &str) -> Vec<u8> {
|
fn compute_item(field: &str) -> Vec<u8> {
|
||||||
let mut bytes = field.as_bytes().to_vec();
|
let mut bytes = field.as_bytes().to_vec();
|
||||||
bytes.push(b'<');
|
bytes.push(b'<');
|
||||||
|
|
Loading…
Reference in a new issue