Skip to content

Conversation

@rockstar
Copy link
Owner

@rockstar rockstar commented Sep 7, 2025

This patch creates a new API for Pidlock, using rust's type system to ensure invalid state transitions are a compile time error, rather than a runtime error.

Pidlock is now Pidlock<T>, where T is a state, New, Acquired, or Released. Only New can be created by a user, and the specific apis allow us to transition from valid state to valid state. For more information, see the included documentation.

@rockstar rockstar force-pushed the refactor/complete-type-safety branch from b389117 to 3c0647e Compare September 7, 2025 18:22
@rockstar
Copy link
Owner Author

rockstar commented Sep 7, 2025

Gonna leave this one open for a bit and stew on it. I like the type safety of it, and the immutability of the lock, but it's a significant change.

This patch creates a new API for `Pidlock`, using rust's type
system to ensure invalid state transitions are a compile time
error, rather than a runtime error.

`Pidlock` is now `Pidlock<T>`, where `T` is a state, `New`,
`Acquired`, or `Released`. Only `New` can be created by a user,
and the specific apis allow us to transition from valid state
to valid state. For more information, see the included
documentation.
@rockstar rockstar force-pushed the refactor/complete-type-safety branch from 3c0647e to ac035c1 Compare September 7, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants