Skip to main content

vyre_driver/backend/
capability.rs

1//! Backend capability traits.
2
3use super::VyreBackend;
4use std::collections::HashSet;
5use vyre_foundation::ir::OpId;
6
7/// Minimal backend identity and capability contract.
8pub trait Backend: Send + Sync {
9    /// Stable backend identifier.
10    fn id(&self) -> &'static str;
11    /// Backend implementation version.
12    fn version(&self) -> &'static str;
13    /// Operation ids this backend can execute without further lowering.
14    fn supported_ops(&self) -> &HashSet<OpId>;
15}
16
17impl<T: VyreBackend + ?Sized> Backend for T {
18    fn id(&self) -> &'static str {
19        VyreBackend::id(self)
20    }
21
22    fn version(&self) -> &'static str {
23        VyreBackend::version(self)
24    }
25
26    fn supported_ops(&self) -> &HashSet<OpId> {
27        VyreBackend::supported_ops(self)
28    }
29}