error interface-not-satisfied
Тип не удовлетворяет интерфейсу.
What it means#
Interfaces are structural (§4.6): a type satisfies I if for each method of I without a default it has a method with the same name, a compatible receiver, the same parameter types, the same or narrower return type, and effects contained in those of the interface. The code is reported where such a satisfaction is required: assert T: I, a generic bound used with a concrete type, or a dyn I conversion.
Example#
interface Shape { fn area() -> f64 }
data Blob { id: u64 }
assert Blob: Shape // <- interface-not-satisfiederror
interface-not-satisfied
How to fix#
interface Shape { fn area() -> f64 }
data Blob { id: u64 }
impl Blob {
fn area() -> f64 => 0.0
}
assert Blob: ShapeAdd the missing method with a matching signature, or relax the interface by giving the method a default body. See also bound-not-satisfied for generic bounds.