pub struct EnumBuilder { /* private fields */ }Available on crate feature
enum only.Expand description
A builder for PHP enums.
Implementations§
Source§impl EnumBuilder
impl EnumBuilder
Sourcepub fn method(
self,
method: FunctionBuilder<'static>,
flags: MethodFlags,
) -> Self
pub fn method( self, method: FunctionBuilder<'static>, flags: MethodFlags, ) -> Self
Adds a method to the enum.
Sourcepub fn registration(
self,
register: fn(&'static mut ClassEntry, ArgInfoTables),
) -> Self
pub fn registration( self, register: fn(&'static mut ClassEntry, ArgInfoTables), ) -> Self
Function to register the enum with PHP, called once it is built.
See ClassBuilder::registration for the ownership contract of the
argument info tables.
§Parameters
register- The function to call to register the enum.
Sourcepub fn docs(self, docs: DocComments) -> Self
pub fn docs(self, docs: DocComments) -> Self
Add documentation comments to the enum.
Sourcepub fn register(self) -> Result<()>
pub fn register(self) -> Result<()>
Registers the enum with PHP.
§Panics
- If called outside a module startup (MINIT) function.
- If the registration function was not set prior to calling this method.
§Errors
Error::DuplicateMethodorError::DuplicateConstant- If two methods or cases share a PHP name.Error::DuplicateClass- If a class with this name, ignoring ASCII case, is already registered.- If the enum could not be registered, e.g. due to an invalid name or data type.
Trait Implementations§
Source§impl From<EnumBuilder> for Enum
impl From<EnumBuilder> for Enum
Source§fn from(val: EnumBuilder) -> Self
fn from(val: EnumBuilder) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Send for EnumBuilder
impl !Sync for EnumBuilder
impl !UnwindSafe for EnumBuilder
impl Freeze for EnumBuilder
impl RefUnwindSafe for EnumBuilder
impl Unpin for EnumBuilder
impl UnsafeUnpin for EnumBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more