pub struct Signature {
pub params: Vec<Type>,
pub returns: Vec<Type>,
pub conv: CallConv,
}Expand description
A function signature: parameter types, return types, and a calling convention.
A function may return any number of values (zero for “returns nothing”).
Signatures are interned per module (Module::intern_signature),
so two equal signatures share one SigId.
§Examples
use ir_lang::{CallConv, Signature, Type};
let sig = Signature::new(&[Type::I64, Type::Ptr], &[Type::Bool]).with_conv(CallConv::C);
assert_eq!(sig.params, [Type::I64, Type::Ptr]);
assert_eq!(sig.to_string(), "(i64, ptr) -> (bool) c");Fields§
§params: Vec<Type>Parameter types, in order.
returns: Vec<Type>Return types, in order.
conv: CallConvThe calling convention.
Implementations§
Trait Implementations§
impl Eq for Signature
Source§impl Ord for Signature
impl Ord for Signature
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Signature
impl PartialOrd for Signature
impl StructuralPartialEq for Signature
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnsafeUnpin for Signature
impl UnwindSafe for Signature
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