std::fs::File
has this impl that allows to use it inside Arc
:
impl Write for Arc<File> {
}
This impl is possible because &File
also implements Write
:
impl Write for &File {
}
If I have my own Write
implementation for &MyStruct
, what stops me from using Arc<MyStruct>
as Write
?
My idea is to add generic impl:
impl<T> Write for Arc<T> where &T: Write, T: Sync {
}