Fix struct spec.

This commit is contained in:
Jesse Brault 2025-09-22 20:57:45 -05:00
parent 8143894257
commit 1b23fbf683

View File

@ -48,15 +48,15 @@ impl SkipChild {
pub struct VecChild { pub struct VecChild {
name: String, name: String,
rule: String, rule: String,
kind: String, build: Box<VecChildBuild>
} }
impl VecChild { impl VecChild {
pub fn new(name: &str, rule: &str, kind: &str) -> Self { pub fn new(name: &str, rule: &str, build: Box<VecChildBuild>) -> Self {
Self { Self {
name: name.to_string(), name: name.to_string(),
rule: rule.to_string(), rule: rule.to_string(),
kind: kind.to_string(), build
} }
} }
@ -69,10 +69,51 @@ impl VecChild {
pub fn rule(&self) -> &str { pub fn rule(&self) -> &str {
&self.rule &self.rule
} }
pub fn build(&self) -> &VecChildBuild {
&self.build
}
}
pub enum VecChildBuild {
String(VecChildStringBuild),
Node(VecChildNodeBuild)
}
pub struct VecChildStringBuild {
with: String
}
impl VecChildStringBuild {
pub fn new(with: &str) -> Self {
Self { with: with.to_string() }
}
pub fn with(&self) -> &str {
&self.with
}
}
pub struct VecChildNodeBuild {
kind: String,
with: String
}
impl VecChildNodeBuild {
pub fn new(kind: &str, with: &str) -> Self {
Self {
kind: kind.to_string(),
with: with.to_string()
}
}
pub fn kind(&self) -> &str { pub fn kind(&self) -> &str {
&self.kind &self.kind
} }
pub fn with(&self) -> &str {
&self.with
}
} }
#[derive(Debug)] #[derive(Debug)]