admin管理员组

文章数量:1402978

I have two ID types, both are Uuid:

type PersonId = Uuid;
type RoomId = Uuid;

And I have a function:

fn get_age(person: PersonId) -> u16 {
    ...
}

But I can call it with RoomId or even with Uuid. How can I restrict it to be callable with only exact PersonId type?

Edit: newtype pattern is a good solution, but it looks me somewhat overhead

本文标签: