What name I should choose for trait

pub trait TransparencyTrait {
    fn set(&mut self, value: f32);
    fn get(&self) -> f32;
}

pub struct Transparency {
    value: f32,
}

impl TransparencyTrait for Transparency {
    fn set(&mut self, value: f32) {
        self.value = value;
    }
    
    fn get(&self) -> f32 {
        self.value
    }
}

pub struct ManagedTransparency {
    transparency: Transparency,
    changed: bool,
}

impl TransparencyTrait for ManagedTransparency {
    fn set(&mut self, value: f32) {
        if self.get() == value {
            return;
        }
        self.transparency.set(value);
        self.changed = true;
    }
    
    fn get(&self) -> f32 {
        self.transparency.get()
    }
}

fn main() {
}

This is a good question. I would like to see the opinion of other fellows.

I would suggest not to use the suffix Trait. That is not idiomatic. Besides, if you are creating a trait, I suppose you will write more code that work with the trait than with implementations, writing Transparency is easier than TransparencyTrait.

Maybe you can name you Transparency struct StandardTransparency or DefaultTransparecy.

I decided to write:

  • Transparency for trait.
  • UnmanagedTransparency for type.