[−][src]Struct rbx_dom_weak::SharedString
A shared buffer of data that is automatically deduplicated so that only one copy of a given buffer is in memory at a time.
SharedString is cheap to clone, since it's internally reference-counted.
This type was introduced by Roblox to help efficiently store data like CSG operation, which was previously kept as BinaryValue objects in CSGDictionaryService.
rbx_dom_weak's implementation of SharedString tries to be faithful to how SharedString works in Roblox, which unfortunately means that it's keyed by MD5 hash. In the event of a hash collision, one of the involved buffers will be silently discarded. It's possible to diverge from this behavior, but could potentially cause edge-case content compatibility issues.
Methods
impl SharedString
[src]
pub fn new(data: Vec<u8>) -> SharedString
[src]
Constructs a SharedString from a buffer of data.
If the data is already present in memory as a SharedString, this method will return a reference to it, otherwise it'll be inserted.
pub fn md5_hash(&self) -> [u8; 16]
[src]
Returns the MD5 hash of the SharedString, which is used as unique identifier presently barring hash collisions.
pub fn data(&self) -> &[u8]
[src]
Returns an immutable reference to the underlying buffer from the SharedString.
Trait Implementations
impl PartialEq<SharedString> for SharedString
[src]
fn eq(&self, other: &SharedString) -> bool
[src]
fn ne(&self, other: &SharedString) -> bool
[src]
impl Drop for SharedString
[src]
impl Eq for SharedString
[src]
impl Clone for SharedString
[src]
fn clone(&self) -> SharedString
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for SharedString
[src]
impl Serialize for SharedString
[src]
impl<'de> Deserialize<'de> for SharedString
[src]
fn deserialize<D>(deserializer: D) -> Result<SharedString, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Auto Trait Implementations
impl Send for SharedString
impl Unpin for SharedString
impl Sync for SharedString
impl UnwindSafe for SharedString
impl RefUnwindSafe for SharedString
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,