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