Trait Transformer

Source
pub trait Transformer<T>: Send + Sync {
    type Output: Serialize;

    // Required methods
    fn transform(&self, resource: T) -> Self::Output;
    fn name(&self) -> &'static str;
}
Expand description

Trait for resource transformers (for API responses)

Required Associated Types§

Source

type Output: Serialize

Output type after transformation

Required Methods§

Source

fn transform(&self, resource: T) -> Self::Output

Transforms the resource

Source

fn name(&self) -> &'static str

Transformer name

Implementors§