Why isn’t Rust narrowing my types inside my match statement?
I have a codebase with the same logic (to get a Vector of bytes) copy-pasted repeatedly:
Enforcing type transitions at compile-time in Rust
I want to create a mechanism that ensures resources are released, similar to how we can use drop
. However I want to enforce more complex constraints using Rust’s type system. I would like to ensure that the user satisfies some constraints before they can drop their object. One way we could with files is we could have a type File<T: ResourceState>
with
Specify in trait method that return type is a generic Self with different concrete type?
I’m trying to implement a typestate system that is generic over its implementation/implementer. For a minimal reproduction, consider 2 states under State
:
Understanding the unsoundness of Rust type compile time eq / neq
I’ve been messing a lot with Rust type system, and I’ve always hit the same barrier, the fact that we can’t tell if two types are the same at compile time. More precisely, the fact that two types are different.
execute(&mut *transaction) vs. execute(&mut transaction)
I’m curious what the difference is between execute(&mut *transaction)
and execute(&mut transaction)
in my example since I didn’t think that transaction
was a pointer to begin with but for some reason execute(&mut *transaction)
satisfies the trait point while execute(&mut transaction)
does not.
Insert rows of Tiberius select query results into Hashmap
I am using the tiberius
crate for MSSQL Queries in Rust.