Allowed to have N immutable references or at most 1 mutable reference with 0 immutable references to an object. I'm sure this has huge implications. I wonder, for example, how you build a mutable doubly-linked list. More to read. #rustlang
-
Show this thread
-
And finally substring / slice / string_view with a nice bit syntactic sugar. Half-open ranges are a good choice.
#rustlang1 reply 0 retweets 0 likesShow this thread -
Ch 5 Structs. Some fairly unique shorthand for initialization with the field init shorthand syntax and .. struct update syntax. Struct tuples as strong typedefs for tuples looks nice. Looks like I have to wait til Ch 10 to see how to have a reference member.
#rustlang1 reply 0 retweets 0 likesShow this thread -
"Methods can take ownership of self" feels weird but I'll try to keep an open mind.
#rustlang1 reply 0 retweets 0 likesShow this thread -
The chapter never explained any rationale for why methods and associated functions (in C++ static member functions) are in a separate impl block apart from the struct definition. It's a mystery.
#rustlang2 replies 0 retweets 0 likesShow this thread -
Also expected to see something about access control ala C++ public/private but no mention of anything like that yet.
#rustlang2 replies 0 retweets 0 likesShow this thread -
Ch 6 Enums in rust look awesome. You can model C-like enums but more interestingly they are sum types that can carry data too. Like a C++ variant but as a language level feature that looks very clean to work with.
#rustlang1 reply 0 retweets 1 likeShow this thread -
It's not clear from this chapter (or I missed it) how enums are actually represented. I suspect they are the size of the largest variant like a C union + extra for the discriminator and that their memory is directly on the stack for a local variable.
#rustlang3 replies 0 retweets 1 likeShow this thread -
If that's the case I wonder if there are any size optimizations for Option<T> where T has a tombstone value.
#rustlang2 replies 0 retweets 0 likesShow this thread -
It's also not clear exactly what happens in a match arm that gets the value out of an enum. Is that value a move/copy/reference or, I hope, just a fancy cast that doesn't change or move anything.
#rustlang2 replies 0 retweets 0 likesShow this thread
Depends on how you use it; often just a reference, but it can move out too!
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.