pub enum RecordTyping {
Nominal,
Structural,
}Expand description
Whether record types are identified by declaration or by shape.
§Examples
use typeck_lang::RecordTyping;
assert_ne!(RecordTyping::Nominal, RecordTyping::Structural);Variants§
Nominal
Two record declarations are different types even with equal fields (Rust, C, Kraken).
Structural
Records with the same field names and types are the same type, and an anonymous record literal of that shape has it (TypeScript, Go’s unnamed structs). Applies to records with named fields; tuple-shaped records and classes stay nominal.
Trait Implementations§
Source§impl Clone for RecordTyping
impl Clone for RecordTyping
impl Copy for RecordTyping
Source§impl Debug for RecordTyping
impl Debug for RecordTyping
impl Eq for RecordTyping
Source§impl Hash for RecordTyping
impl Hash for RecordTyping
Source§impl PartialEq for RecordTyping
impl PartialEq for RecordTyping
impl StructuralPartialEq for RecordTyping
Auto Trait Implementations§
impl Freeze for RecordTyping
impl RefUnwindSafe for RecordTyping
impl Send for RecordTyping
impl Sync for RecordTyping
impl Unpin for RecordTyping
impl UnsafeUnpin for RecordTyping
impl UnwindSafe for RecordTyping
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more