Module libreda_db::rc_string

source ·
Expand description

RcString is a simple data structure for the representation of strings. In contrast to String, RcString can be efficiently cloned. It is intended to be used in cases where objects are indexed by a human readable name.

Example

use libreda_db::rc_string::RcString;

let a: String = "A".to_string();

let a1_rc = RcString::from(a);
let a2_rc = RcString::from("A");

// No string data is copied here.
let a3_rc = a1_rc.clone();

assert_eq!(a1_rc, a2_rc);
assert_eq!(a1_rc, a3_rc);

Structs

  • Resource counted string, used for names. RcStrings can be efficiently cloned.