use crate::io::RenderKotlin;
use crate::spec::CodeBlock;
use crate::tokens;
#[derive(Debug, Clone)]
pub enum GenericInvariance {
In,
Out,
}
impl RenderKotlin for GenericInvariance {
fn render_into(&self, block: &mut CodeBlock) {
match self {
GenericInvariance::In => block.push_static_atom(tokens::keyword::IN),
GenericInvariance::Out => block.push_static_atom(tokens::keyword::OUT),
}
}
}
#[cfg(test)]
mod tests {
use crate::io::RenderKotlin;
use super::*;
#[test]
fn test_generic_invariance() {
let invariance = GenericInvariance::In;
assert_eq!(invariance.render_string(), "in");
let invariance = GenericInvariance::Out;
assert_eq!(invariance.render_string(), "out");
}
}