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 {
name: String,
rule: String,
kind: String,
build: Box<VecChildBuild>
}
impl VecChild {
pub fn new(name: &str, rule: &str, kind: &str) -> Self {
pub fn new(name: &str, rule: &str, build: Box<VecChildBuild>) -> Self {
Self {
name: name.to_string(),
rule: rule.to_string(),
kind: kind.to_string(),
build
}
}
@ -70,9 +70,50 @@ impl VecChild {
&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 {
&self.kind
}
pub fn with(&self) -> &str {
&self.with
}
}
#[derive(Debug)]