#unsafe #standard #version #i32 #from-t #into-t #my-unsafe-type

unsafe_from

Unsafe versions of standard library From<T> and Into<T>

1 stable release

1.0.0 Aug 20, 2020

#41 in #i32

MIT license

3KB

Unsafe versions of standard library From<T> and Into<T>.

Install

[dependencies]
unsafe_from = "1.0.0"

Use

use unsafe_from::UnsafeFrom;

struct MyUnsafeType(i32);

unsafe impl UnsafeFrom<i32> for MyUnsafeType {
    unsafe fn unsafe_from(t: i32) -> MyUnsafeType {
        MyUnsafeType(t)
    }
}

lib.rs:

Unsafe versions of standard library From<T> and Into<T>.

No runtime deps