pub struct InterfaceEntity { /* private fields */ }
Expand description
Builder for registering interface.
Implementations§
Source§impl InterfaceEntity
impl InterfaceEntity
Sourcepub fn new(interface_name: impl Into<String>) -> Self
pub fn new(interface_name: impl Into<String>) -> Self
Construct a new InterfaceEntity
with interface name.
Sourcepub fn add_method(&mut self, name: impl Into<String>) -> &mut MethodEntity
pub fn add_method(&mut self, name: impl Into<String>) -> &mut MethodEntity
Add member method to interface, with mandatory visibility public abstract.
Sourcepub fn add_static_method(
&mut self,
name: impl Into<String>,
) -> &mut MethodEntity
pub fn add_static_method( &mut self, name: impl Into<String>, ) -> &mut MethodEntity
Add static member method to interface.
Sourcepub fn add_constant(
&mut self,
name: impl Into<String>,
value: impl Into<Scalar>,
)
pub fn add_constant( &mut self, name: impl Into<String>, value: impl Into<Scalar>, )
Add constant to interface
Sourcepub fn extends(&mut self, interface: Interface)
pub fn extends(&mut self, interface: Interface)
Register interface to extends
the interfaces, due to the interface can
extends multi interface, so this method can be called multi time.
Because in the MINIT
phase, the class starts to register, a
closure is used to return the ClassEntry
to delay the acquisition of
the class.
§Examples
use phper::classes::{Interface, InterfaceEntity};
let mut interface = InterfaceEntity::new("MyInterface");
interface.extends(Interface::from_name("Stringable"));
Sourcepub fn bound_interface(&self) -> Interface
pub fn bound_interface(&self) -> Interface
Get the bound interface.
Auto Trait Implementations§
impl Freeze for InterfaceEntity
impl !RefUnwindSafe for InterfaceEntity
impl !Send for InterfaceEntity
impl !Sync for InterfaceEntity
impl Unpin for InterfaceEntity
impl !UnwindSafe for InterfaceEntity
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