-
-
Save vsajip/11f93e8ab92865c73cc3b6f16fbb3602 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{BufRead}; | |
struct Processor<B: BufRead> { | |
reader: B | |
} | |
// If you uncomment p in ValidatorA, compilation fails because the size of | |
// ValidatorA can't be determined at compile time. Fair enough. | |
struct ValidatorA { | |
// p : Processor<BufRead> | |
} | |
// In ValidatorB, compilation fails for the same reason as above - but why? | |
// Aren't references a fixed size - a sort of fat pointer, if you will? | |
struct ValidatorB<'a> { | |
p : &'a Processor<BufRead> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment