Unsafeなトレイトの実装
関数と同様に、未定義の動作を回避するために実装で特定の条件を保証する必要がある場合は、トレイトを unsafe
としてマークできます。
For example, the zerocopy
crate has an unsafe trait that looks something like this:
Speaker Notes
This slide should take about 5 minutes.
Rustdoc には、トレイトを安全に実装するための要件について説明した # Safety
セクションが必要です。
The actual safety section for IntoBytes
is rather longer and more complicated.
組み込みの Send
トレイトと Sync
トレイトはアンセーフです。