#![doc = include_str!("../README.md")]
#![deny(missing_docs, unreachable_pub, private_interfaces, private_bounds)]
#![deny(rustdoc::broken_intra_doc_links, rustdoc::private_intra_doc_links)]
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used))]
pub use pliron;
pub use pliron::result::{Error, Result};
pub use pliron_mlir_builtin;
pub mod attributes;
mod error;
pub use error::{Diagnostic, RecoveryCategory};
#[cfg(feature = "mlir-interop")]
pub mod mlir;
pub mod ops;
pub mod shaped;
#[doc(hidden)]
#[macro_export]
macro_rules! shared_attr {
($op:ty, $key:path, $ty:ty, $get:ident, $set:ident) => {
impl $op {
#[doc = concat!("Returns the `", stringify!($ty), "` attribute, if present.")]
pub fn $get<'a>(
&self,
ctx: &'a $crate::pliron::context::Context,
) -> ::core::option::Option<::core::cell::Ref<'a, $ty>> {
let op = <Self as $crate::pliron::op::Op>::get_operation(self);
::core::cell::Ref::filter_map(op.deref(ctx), |op| op.attributes.get::<$ty>(&$key))
.ok()
}
#[doc = concat!("Sets the `", stringify!($ty), "` attribute.")]
pub fn $set(&self, ctx: &$crate::pliron::context::Context, value: $ty) {
let op = <Self as $crate::pliron::op::Op>::get_operation(self);
op.deref_mut(ctx).attributes.set($key.clone(), value);
}
}
};
}