-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Problem
Currently, icicle-python is using an enum to represent memory protection:
#[pyclass(eq, eq_int, module = "icicle")]
#[derive(Clone, Debug, PartialEq)]
pub enum MemoryProtection {
NoAccess,
ReadOnly,
ReadWrite,
ExecuteOnly,
ExecuteRead,
ExecuteReadWrite,
}There are two issues I have come across with this:
- This enum is not exhaustive, It is missing
WriteOnlyandExecuteWriteoptions (certainly rare but these do occur) - Cannot construct using
oroperations, for example to construct permissions like so:read_bit | write_bit | exec_bit.
Proposed solutions
Option 1: Just use a u8
This is what Icicle is already doing, and I think simplicity is the best approach here. Users are probably already familiar with this encoding and it has minimal overhead since it is a primitive type.
Option 2: Improve enum and implement __or__
This has the benefit that it should maintain compatibility while resolving the issues above. Downside is that this seems maybe excessive for just representing a u8.
Let me know if you have any thoughts and I can prepare a PR for either option.
Metadata
Metadata
Assignees
Labels
No labels