> `Io` trait now has a single required method with many more provided
> methods. Provided methods may want to rely on their implementations to not
> be arbitrarily overridden by implementers for correctness or soundness.
> A good example is the `size` method, it may be relied by unsafe code and
> thus must be consistent with the metadata obtained from `as_ptr`.
> 
> Thus, create a new trait to host `size` method, extract existing provided
> methods to the new trait, and provide a blanket implementation. This
> pattern is used extensively in userspace Rust libraries e.g. `tokio` where
> `AsyncRead` has minimum methods and `AsyncReadExt` is what users mostly
> interact with.
> 
> To avoid changing all user imports, the base trait is renamed to `IoBase`
> and the newly added trait takes the existing `Io` name.
> 
> Reviewed-by: Alexandre Courbot <[email protected]>
> Suggested-by: Danilo Krummrich <[email protected]>
> Signed-off-by: Gary Guo <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=12

Reply via email to