Created
January 7, 2020 16:36
-
-
Save MabezDev/ecbf8546fc59a55ea404513be15868e3 to your computer and use it in GitHub Desktop.
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 rtfm::Mutex; // or mutex_trait | |
pub enum Operation<T: Mutex<T = ...> { | |
FileSystem(T) // Note: can't use impl Mutex<T = Filesystem> here, so we have to introduce the T type param | |
// ... | |
} | |
// If the `Operation` enum is buried deep within a type, it poisens that type with the same type parameter | |
pub struct Server<T: Mutex<T = ...> { | |
op: Operation<T> | |
} | |
// question: is it possible to avoid the generic type parameter when using any Mutex with rtfm? | |
// internally, rtfm uses resource proxies that implement the Mutex trait. | |
// Is it safe to use these types or are they considered an implementation detail? | |
// I'm guessing the latter as `mod Resources` is private |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment