[solved]What does "struct TypeMap<A: ?Sized = UnsafeAny>" mean?


#1
#[derive(Default, Debug)]
pub struct TypeMap<A: ?Sized = UnsafeAny>
where A: UnsafeAnyExt {
    data: HashMap<TypeId, Box<A>>
}

The codes come from here: http://ironframework.io/doc/src/typemap/lib.rs.html#27
I don’t know why there is a “=” between “?Sized” and “UnsafeAny”.
Associated type???


#2

Default. A is any type (including ones that don’t implement Sized), and defaults to UnsafeAny if not otherwise specified or constrained.

Edit: I’d link you to where it’s explained in the book, but it doesn’t appear to be.


#3

Default type parameter: https://github.com/rust-lang/rfcs/blob/master/text/0213-defaulted-type-params.md


#4

Nice answers! Thank you! @DanielKeep @vitalyd