pub trait NativeHostDocumentBackend: ScriptDocumentBackend {
type Host;
// Required method
fn attach_native_host(&mut self, host: Self::Host) -> Result<(), String>;
}Expand description
Opt-in support for attaching an engine-native host to a script document.
Attachment is a separate, fallible step so callers can complete it after
constructing the document and before calling execute_scripts. This
extension does not change the requirements for ScriptDocumentBackend.
Required Associated Types§
Required Methods§
Sourcefn attach_native_host(&mut self, host: Self::Host) -> Result<(), String>
fn attach_native_host(&mut self, host: Self::Host) -> Result<(), String>
Attach host to this document before executing its scripts.
Ownership of host transfers to the backend when this method is
called. On success, the backend keeps it for the attached document’s
lifetime and is responsible for releasing it during teardown or
disposal. On failure, the backend must release any partially attached
resources and must not retain host as an attached host. This method
does not execute scripts.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".