Thanks to visit codestin.com
Credit goes to docs.rs

Skip to main content

from_string

Function from_string 

Source
pub fn from_string(v: String) -> RawBytes<String>
Expand description

Create a raw-byte hashable value from a string.

This hashes the UTF-8 bytes of the string without Rust’s string length prefix.

§Examples

assert_eq!(
    calculate_hash(from_string("abc".to_owned())),
    calculate_hash(from_str("abc"))
);
assert!(from_string(String::new()).is_empty());
assert!(!from_string("abc".to_string()).is_empty());