Add explicit managed traits and inherited method arity contracts
This commit is contained in:
@@ -14,6 +14,31 @@ pub struct Vm {
|
||||
}
|
||||
|
||||
impl Vm {
|
||||
pub fn new_trait(
|
||||
&mut self,
|
||||
name: impl Into<String>,
|
||||
requirements: Vec<crate::MethodRequirement>,
|
||||
) -> Result<ObjectRef, VmError> {
|
||||
self.objects.new_trait(name, requirements)
|
||||
}
|
||||
pub fn implement_trait(
|
||||
&mut self,
|
||||
definition: ObjectRef,
|
||||
capability: ObjectRef,
|
||||
) -> Result<(), VmError> {
|
||||
self.objects.implement_trait(definition, capability)
|
||||
}
|
||||
pub fn implements_trait(
|
||||
&self,
|
||||
definition: ObjectRef,
|
||||
capability: ObjectRef,
|
||||
) -> Result<bool, VmError> {
|
||||
self.objects.implements_trait(definition, capability)
|
||||
}
|
||||
pub fn supports(&self, object: ObjectRef, capability: ObjectRef) -> Result<bool, VmError> {
|
||||
self.objects.supports(object, capability)
|
||||
}
|
||||
|
||||
pub fn define_method(
|
||||
&mut self,
|
||||
type_object: ObjectRef,
|
||||
|
||||
Reference in New Issue
Block a user