Skip to content
CryoCryo home
Stdlibcore

default

import std::core::default; · source

Default

type trait Default {
    static default() -> This;
}

Default supplies a canonical zero value so generic code can construct without knowing the concrete type: zero for numbers, false for boolean, '�' for char. The containers implement it as "a fresh empty one that allocates nothing", so an Array<T> or HashMap<K, V> can sit in a struct that derives its own default.

Implementors

implement trait Default for i8

implement trait Default for i16

implement trait Default for i32

implement trait Default for i64

implement trait Default for u8

implement trait Default for u16

implement trait Default for u32

implement trait Default for u64

implement trait Default for i128

implement trait Default for u128

implement trait Default for usize

implement trait Default for isize

implement trait Default for f32

implement trait Default for f64

implement trait Default for boolean

implement trait Default for char

implement<T> trait Default for struct Array<T, GlobalAlloc>   // std::collections::array

implement<K, V> trait Default for struct HashMap<K, V, GlobalAlloc>   // std::collections::hashmap

implement<T> trait Default for struct HashSet<T, GlobalAlloc>   // std::collections::hashset

implement trait Default for struct String<GlobalAlloc>   // std::collections::string