pub struct Modify<S: ExtendVec + 'static = Vec<u8>> { /* private fields */ }Expand description
A modification to a resource.
The resource must be initialised using Create.
Implementations§
source§impl Modify
impl Modify
sourcepub fn new(resource: String, target: &[u8], base: &[u8]) -> Self
pub fn new(resource: String, target: &[u8], base: &[u8]) -> Self
Get the difference needed to get from base to target, as a modify event.
sourcepub fn new_with_verification(
resource: String,
target: &[u8],
base: &[u8],
) -> Self
pub fn new_with_verification( resource: String, target: &[u8], base: &[u8], ) -> Self
Get the difference needed to get from base to target, as a modify event.
This also verifies that the Modify::diff gives target.
Using this over Self::new is only recommended when you have data that
MUST be transmitted correctly.
Most errors will however resolve once the client reconnects to the network or if a server, performs a hash check.
This does not trigger an allocation.
If the verification failed, we send the whole resource.
Trait Implementations§
source§impl<'de, S> Deserialize<'de> for Modify<S>where
S: Deserialize<'de> + ExtendVec + 'static,
impl<'de, S> Deserialize<'de> for Modify<S>where
S: Deserialize<'de> + ExtendVec + 'static,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<S: Eq + ExtendVec + 'static> Eq for Modify<S>
impl<S: ExtendVec + 'static> StructuralPartialEq for Modify<S>
Auto Trait Implementations§
impl<S> Freeze for Modify<S>
impl<S> RefUnwindSafe for Modify<S>where
S: RefUnwindSafe,
impl<S> Send for Modify<S>where
S: Send,
impl<S> Sync for Modify<S>where
S: Sync,
impl<S> Unpin for Modify<S>where
S: Unpin,
impl<S> UnwindSafe for Modify<S>where
S: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)