You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-08-08 00:12:51 +02:00
ensure to have explicit main functions in typestate pattern
This commit is contained in:
@ -32,12 +32,14 @@ impl SerializeStruct {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let ser = Serializer::default()
|
||||
.serialize_struct("User")
|
||||
.serialize_field("id", "42")
|
||||
.serialize_field("name", "Alice")
|
||||
.finish_struct();
|
||||
println!("{}", ser.output);
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
|
@ -5,7 +5,6 @@ shared logic across state variants, while still encoding state transitions in
|
||||
the type system.
|
||||
|
||||
```rust
|
||||
# fn main() -> std::io::Result<()> {
|
||||
#[non_exhaustive]
|
||||
struct Insecure;
|
||||
struct Secure {
|
||||
@ -85,13 +84,14 @@ impl<T: Transport> ConnectionBuilder<Ready<T>> {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let _conn = Connection::new("db.local")
|
||||
.secure()
|
||||
.client_certificate(vec![1, 2, 3])
|
||||
.timeout(10)
|
||||
.connect()?;
|
||||
Ok(())
|
||||
# }
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
|
Reference in New Issue
Block a user