1974 shaares
6 private links
6 private links
export DEBUGINFOD_URLS="https://debuginfod.debian.net"
struct Id<T> {
inner: u64,
_marker: std::marker::PhantomData<T>,
}
impl<T> Id<T> {
pub fn new(inner: u64) -> Self {
Self {
inner,
_marker: std::marker::PhantomData
}
}
}
struct UserIdMarker;
struct GroupIdMarker;
pub type UserId = Id<UserIdMarker>;
pub type GroupId = Id<GroupIdMarker>;
//...
fn ping_user(id: UserId) {
//...
}
ping_user(GroupId::new(12345)); // This triggers an error
$ aptitude search librust- | grep -vE "^v " | wc -l
2336