use crate::Span;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DeclarationSignature {
pub name_span: Span,
pub span: Span,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct SignatureRule {
pub node: &'static str,
pub body: Option<&'static str>,
pub initializer: Option<&'static str>,
pub body_kind: Option<&'static str>,
}
impl SignatureRule {
pub const fn whole(node: &'static str) -> Self {
Self {
node,
body: None,
initializer: None,
body_kind: None,
}
}
pub const fn header(node: &'static str, body: &'static str) -> Self {
Self {
node,
body: Some(body),
initializer: None,
body_kind: None,
}
}
pub const fn callable(
node: &'static str,
initializer: &'static str,
body: &'static str,
) -> Self {
Self {
node,
initializer: Some(initializer),
body: Some(body),
body_kind: None,
}
}
pub const fn body_kind(mut self, kind: &'static str) -> Self {
self.body_kind = Some(kind);
self
}
}