UniqueEntityImplementationHelper

Trait UniqueEntityImplementationHelper 

Source
pub trait UniqueEntityImplementationHelper {
    // Required methods
    fn new(content: Vec<u8>) -> Self;
    fn content(&self) -> &[u8] ;
}
Expand description

Unique entity implementation/migration helper.

The old trait UniqueEntity required two methods:

  • fn new(content: Vec<u8>) -> Self;
  • fn content(&self) -> &[u8];

It then provided a bunch of default methods.

The whole structure of the traits has changed, now. But we can stil offer that same kind of convenience, and replicate those defaults.

If you implement this trait, you get the following traits auto-implemented:

  • UniqueEntity
  • Entity
  • EntityDatabaseMutation

§Warning

If your old UniqueEntity implementation defined anything other than the two required methods, you mut implement these traits manually to preserve the existing behaviors. Otherwise the behaviors will change!

Required Methods§

Source

fn new(content: Vec<u8>) -> Self

Source

fn content(&self) -> &[u8]

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§