pub mod comments;
pub mod format_config;
pub mod parser;
pub mod parser_config;
use comments::strip_comments;
use format_config::FormatConfig;
pub use parser_config::ParserConfig;
use std::borrow::Cow;
#[cfg(feature = "macro")]
pub use links_notation_macro::lino;
use std::error::Error as StdError;
use std::fmt;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Debug)]
pub enum ParseError {
EmptyInput,
SyntaxError(SyntaxError),
InternalError(String),
}
impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ParseError::EmptyInput => write!(f, "Empty input"),
ParseError::SyntaxError(error) => write!(f, "Syntax error at {}", error),
ParseError::InternalError(msg) => write!(f, "Internal error: {}", msg),
}
}
}
impl StdError for ParseError {}
const QUOTED_LINE_WIDTH: usize = 80;
const ELLIPSIS: &str = "...";
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SyntaxError {
pub offset: usize,
pub line: usize,
pub column: usize,
pub expected: Vec<String>,
pub found: Option<char>,
pub line_text: String,
}
impl SyntaxError {
pub fn summary(&self) -> String {
let found = match self.found {
Some(character) => format!("\"{}\"", character.escape_debug()),
None => "end of input".to_string(),
};
match join_alternatives(&self.expected) {
Some(expected) => format!(
"line {}, column {}: expected {}, found {}",
self.line, self.column, expected, found
),
None => format!(
"line {}, column {}: unexpected {}",
self.line, self.column, found
),
}
}
pub fn snippet(&self) -> String {
let (quoted, column) = quote_line(&self.line_text, self.column);
let number = self.line.to_string();
let gutter = " ".repeat(number.len());
format!(
"{} | {}\n{} | {}^",
number,
quoted,
gutter,
" ".repeat(column - 1)
)
}
}
impl fmt::Display for SyntaxError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}\n{}", self.summary(), self.snippet())
}
}
impl StdError for SyntaxError {}
fn join_alternatives(alternatives: &[String]) -> Option<String> {
match alternatives {
[] => None,
[only] => Some(only.clone()),
[rest @ .., last] => Some(format!("{} or {}", rest.join(", "), last)),
}
}
fn quote_line(line: &str, column: usize) -> (String, usize) {
let characters: Vec<char> = line.chars().collect();
if characters.len() <= QUOTED_LINE_WIDTH {
return (line.to_string(), column);
}
let target = column - 1;
let last_start = characters.len() - QUOTED_LINE_WIDTH;
let start = target.saturating_sub(QUOTED_LINE_WIDTH / 2).min(last_start);
let end = start + QUOTED_LINE_WIDTH;
let mut quoted = String::new();
if start > 0 {
quoted.push_str(ELLIPSIS);
}
quoted.extend(&characters[start..end]);
if end < characters.len() {
quoted.push_str(ELLIPSIS);
}
let shift = if start > 0 {
ELLIPSIS.chars().count()
} else {
0
};
(quoted, target - start + shift + 1)
}
fn locate(document: &str, failure: parser::ParseFailure) -> SyntaxError {
let offset = failure.offset.min(document.len());
let before = &document[..offset];
let line = before.matches('\n').count() + 1;
let line_start = before.rfind('\n').map_or(0, |position| position + 1);
let column = document[line_start..offset].chars().count() + 1;
let line_end = document[line_start..]
.find('\n')
.map_or(document.len(), |position| line_start + position);
let line_text = document[line_start..line_end].trim_end_matches('\r');
SyntaxError {
offset,
line,
column,
expected: failure.expected.iter().map(|s| s.to_string()).collect(),
found: document[offset..].chars().next(),
line_text: line_text.to_string(),
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum LiNo<T> {
Link { id: Option<T>, values: Vec<Self> },
Ref(T),
}
impl<T> LiNo<T> {
pub fn is_ref(&self) -> bool {
matches!(self, LiNo::Ref(_))
}
pub fn is_link(&self) -> bool {
matches!(self, LiNo::Link { .. })
}
pub fn new(id: Option<T>, values: Vec<Self>) -> Self {
LiNo::Link { id, values }
}
pub fn anonymous(values: Vec<Self>) -> Self {
LiNo::Link { id: None, values }
}
pub fn reference(value: T) -> Self {
LiNo::Ref(value)
}
}
#[derive(Debug, Clone, Default)]
pub struct LiNoBuilder {
id: Option<String>,
values: Vec<LiNo<String>>,
}
impl LiNoBuilder {
pub fn new() -> Self {
Self::default()
}
pub fn id(mut self, id: &str) -> Self {
self.id = Some(id.to_string());
self
}
pub fn value(mut self, value: &str) -> Self {
self.values.push(LiNo::Ref(value.to_string()));
self
}
pub fn lino(mut self, value: LiNo<String>) -> Self {
self.values.push(value);
self
}
pub fn values<I, S>(mut self, values: I) -> Self
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
for v in values {
self.values.push(LiNo::Ref(v.as_ref().to_string()));
}
self
}
pub fn linos<I>(mut self, values: I) -> Self
where
I: IntoIterator<Item = LiNo<String>>,
{
self.values.extend(values);
self
}
pub fn build(self) -> LiNo<String> {
LiNo::Link {
id: self.id,
values: self.values,
}
}
}
#[deprecated(since = "0.3.0", note = "Use LiNoBuilder instead")]
pub type LinkBuilder = LiNoBuilder;
impl<T: ToString + Clone> LiNo<T> {
pub fn format_with_config(&self, config: &FormatConfig) -> String {
match self {
LiNo::Ref(value) => {
let escaped = escape_reference(&value.to_string());
if config.less_parentheses {
escaped
} else {
format!("({})", escaped)
}
}
LiNo::Link { id, values } => {
if id.is_none() && values.is_empty() {
return if config.less_parentheses {
String::new()
} else {
"()".to_string()
};
}
if values.is_empty() {
if let Some(ref id_val) = id {
let escaped_id = escape_reference(&id_val.to_string());
return if config.less_parentheses && !needs_parentheses(&id_val.to_string())
{
escaped_id
} else {
format!("({})", escaped_id)
};
}
return if config.less_parentheses {
String::new()
} else {
"()".to_string()
};
}
let mut should_indent = false;
if config.should_indent_by_ref_count(values.len()) {
should_indent = true;
} else {
let values_str = values
.iter()
.map(|v| format_value(v))
.collect::<Vec<_>>()
.join(" ");
let test_line = if let Some(ref id_val) = id {
let id_str = escape_reference(&id_val.to_string());
if config.less_parentheses {
format!("{}: {}", id_str, values_str)
} else {
format!("({}: {})", id_str, values_str)
}
} else if config.less_parentheses {
values_str.clone()
} else {
format!("({})", values_str)
};
if config.should_indent_by_length(&test_line) {
should_indent = true;
}
}
if should_indent && !config.prefer_inline {
return self.format_indented(config);
}
let values_str = values
.iter()
.map(|v| format_value(v))
.collect::<Vec<_>>()
.join(" ");
if id.is_none() {
if config.less_parentheses {
let all_simple = values.iter().all(|v| matches!(v, LiNo::Ref(_)));
if all_simple {
return values
.iter()
.map(|v| match v {
LiNo::Ref(r) => escape_reference(&r.to_string()),
_ => format_value(v),
})
.collect::<Vec<_>>()
.join(" ");
}
return values_str;
}
return format!("({})", values_str);
}
let id_str = escape_reference(&id.as_ref().unwrap().to_string());
let with_colon = format!("{}: {}", id_str, values_str);
if config.less_parentheses && !needs_parentheses(&id.as_ref().unwrap().to_string())
{
with_colon
} else {
format!("({})", with_colon)
}
}
}
}
fn format_indented(&self, config: &FormatConfig) -> String {
match self {
LiNo::Ref(value) => {
let escaped = escape_reference(&value.to_string());
format!("({})", escaped)
}
LiNo::Link { id, values } => {
if id.is_none() {
values
.iter()
.map(|v| format!("{}{}", config.indent_string, format_value(v)))
.collect::<Vec<_>>()
.join("\n")
} else {
let id_str = escape_reference(&id.as_ref().unwrap().to_string());
let mut lines = vec![format!("{}:", id_str)];
for v in values {
lines.push(format!("{}{}", config.indent_string, format_value(v)));
}
lines.join("\n")
}
}
}
}
}
impl<T: ToString> fmt::Display for LiNo<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
LiNo::Ref(value) => {
let value = value.to_string();
if value.is_empty() {
write!(f, "\"\"")
} else {
write!(f, "{}", value)
}
}
LiNo::Link { id, values } => {
let id_str = id
.as_ref()
.map(|id| {
let id = id.to_string();
if id.is_empty() {
"\"\": ".to_string()
} else {
format!("{}: ", id)
}
})
.unwrap_or_default();
if f.alternate() {
let lines = values
.iter()
.map(|value| {
match value {
LiNo::Ref(_) => format!("{}({})", id_str, value),
_ => format!("{}{}", id_str, value),
}
})
.collect::<Vec<_>>()
.join("\n");
write!(f, "{}", lines)
} else {
let values_str = values
.iter()
.map(|value| value.to_string())
.collect::<Vec<_>>()
.join(" ");
write!(f, "({}{})", id_str, values_str)
}
}
}
}
}
impl From<parser::Link> for LiNo<String> {
fn from(link: parser::Link) -> Self {
if let Some(body) = &link.nested {
return transform_nested(body);
}
if link.values.is_empty() && link.children.is_empty() {
if let Some(id) = link.id {
LiNo::Ref(id)
} else {
LiNo::Link {
id: None,
values: vec![],
}
}
} else {
let values: Vec<LiNo<String>> = link.values.into_iter().map(|v| v.into()).collect();
LiNo::Link {
id: link.id,
values,
}
}
}
}
fn transform_nested(body: &[parser::Link]) -> LiNo<String> {
let links = flatten_links(body.to_vec());
let wraps_single_group =
body.len() == 1 && body[0].nested.is_some() && body[0].children.is_empty();
if links.len() == 1 && !wraps_single_group {
return links.into_iter().next().unwrap();
}
LiNo::Link {
id: None,
values: links,
}
}
fn flatten_links(links: Vec<parser::Link>) -> Vec<LiNo<String>> {
let mut result = vec![];
for link in links {
flatten_link_recursive(&link, None, &mut result);
}
result
}
fn flatten_link_recursive(
link: &parser::Link,
parent: Option<&LiNo<String>>,
result: &mut Vec<LiNo<String>>,
) {
if link.is_indented_id
&& link.id.is_some()
&& link.values.is_empty()
&& !link.children.is_empty()
{
let child_values: Vec<LiNo<String>> = link
.children
.iter()
.map(|child| {
if child.values.len() == 1
&& child.values[0].values.is_empty()
&& child.values[0].children.is_empty()
{
if let Some(ref id) = child.values[0].id {
LiNo::Ref(id.clone())
} else {
parser::Link {
id: child.id.clone(),
values: child.values.clone(),
children: vec![],
is_indented_id: false,
nested: child.nested.clone(),
}
.into()
}
} else {
parser::Link {
id: child.id.clone(),
values: child.values.clone(),
children: vec![],
is_indented_id: false,
nested: child.nested.clone(),
}
.into()
}
})
.collect();
let current = LiNo::Link {
id: link.id.clone(),
values: child_values,
};
let combined = if let Some(parent) = parent {
let wrapped_parent = match parent {
LiNo::Ref(ref_id) => LiNo::Link {
id: None,
values: vec![LiNo::Ref(ref_id.clone())],
},
link => link.clone(),
};
LiNo::Link {
id: None,
values: vec![wrapped_parent, current],
}
} else {
current
};
result.push(combined);
return; }
let current = if let Some(body) = &link.nested {
transform_nested(body)
} else if link.values.is_empty() {
if let Some(id) = &link.id {
LiNo::Ref(id.clone())
} else {
LiNo::Link {
id: None,
values: vec![],
}
}
} else {
let values: Vec<LiNo<String>> = link
.values
.iter()
.map(|v| {
parser::Link {
id: v.id.clone(),
values: v.values.clone(),
children: vec![],
is_indented_id: false,
nested: v.nested.clone(),
}
.into()
})
.collect();
LiNo::Link {
id: link.id.clone(),
values,
}
};
let combined = if let Some(parent) = parent {
let wrapped_parent = match parent {
LiNo::Ref(ref_id) => LiNo::Link {
id: None,
values: vec![LiNo::Ref(ref_id.clone())],
},
link => link.clone(),
};
let wrapped_current = match ¤t {
LiNo::Ref(ref_id) => LiNo::Link {
id: None,
values: vec![LiNo::Ref(ref_id.clone())],
},
link => link.clone(),
};
LiNo::Link {
id: None,
values: vec![wrapped_parent, wrapped_current],
}
} else {
current.clone()
};
result.push(combined.clone());
for child in &link.children {
flatten_link_recursive(child, Some(&combined), result);
}
}
fn prepare<'a>(document: &'a str, config: &ParserConfig) -> Cow<'a, str> {
if config.comments {
Cow::Owned(strip_comments(document))
} else {
Cow::Borrowed(document)
}
}
pub fn parse_lino(document: &str) -> Result<LiNo<String>, ParseError> {
parse_lino_with_config(document, &ParserConfig::default())
}
pub fn parse_lino_with_config(
document: &str,
config: &ParserConfig,
) -> Result<LiNo<String>, ParseError> {
if document.trim().is_empty() {
return Ok(LiNo::Link {
id: None,
values: vec![],
});
}
let prepared = prepare(document, config);
match parser::parse_document_with_diagnostics(&prepared) {
Ok(links) => {
if links.is_empty() {
Ok(LiNo::Link {
id: None,
values: vec![],
})
} else {
let flattened = flatten_links(links);
Ok(LiNo::Link {
id: None,
values: flattened,
})
}
}
Err(failure) => Err(ParseError::SyntaxError(locate(document, failure))),
}
}
pub fn parse_lino_to_links(document: &str) -> Result<Vec<LiNo<String>>, ParseError> {
parse_lino_to_links_with_config(document, &ParserConfig::default())
}
pub fn parse_lino_to_links_with_config(
document: &str,
config: &ParserConfig,
) -> Result<Vec<LiNo<String>>, ParseError> {
if document.trim().is_empty() {
return Ok(vec![]);
}
let prepared = prepare(document, config);
match parser::parse_document_with_diagnostics(&prepared) {
Ok(links) => {
if links.is_empty() {
Ok(vec![])
} else {
let flattened = flatten_links(links);
Ok(flattened)
}
}
Err(failure) => Err(ParseError::SyntaxError(locate(document, failure))),
}
}
pub fn format_links(links: &[LiNo<String>]) -> String {
links
.iter()
.map(|link| format!("{}", link))
.collect::<Vec<_>>()
.join("\n")
}
pub fn format_links_with_config(links: &[LiNo<String>], config: &FormatConfig) -> String {
if links.is_empty() {
return String::new();
}
let links_to_format = if config.group_consecutive {
group_consecutive_links(links)
} else {
links.to_vec()
};
links_to_format
.iter()
.map(|link| link.format_with_config(config))
.collect::<Vec<_>>()
.join("\n")
}
fn group_consecutive_links(links: &[LiNo<String>]) -> Vec<LiNo<String>> {
if links.is_empty() {
return vec![];
}
let mut grouped = vec![];
let mut i = 0;
while i < links.len() {
let current = &links[i];
if let LiNo::Link {
id: Some(ref current_id),
values: ref current_values,
} = current
{
if !current_values.is_empty() {
let mut same_id_values = current_values.clone();
let mut j = i + 1;
while j < links.len() {
if let LiNo::Link {
id: Some(ref next_id),
values: ref next_values,
} = &links[j]
{
if next_id == current_id && !next_values.is_empty() {
same_id_values.extend(next_values.clone());
j += 1;
} else {
break;
}
} else {
break;
}
}
if j > i + 1 {
grouped.push(LiNo::Link {
id: Some(current_id.clone()),
values: same_id_values,
});
i = j;
continue;
}
}
}
grouped.push(current.clone());
i += 1;
}
grouped
}
fn escape_reference(reference: &str) -> String {
if reference.is_empty() {
return "\"\"".to_string();
}
let has_single_quote = reference.contains('\'');
let has_double_quote = reference.contains('"');
let needs_quoting = reference.starts_with('#')
|| reference.contains(':')
|| reference.contains('(')
|| reference.contains(')')
|| reference.contains(' ')
|| reference.contains('\t')
|| reference.contains('\n')
|| reference.contains('\r')
|| has_double_quote
|| has_single_quote;
if has_single_quote && has_double_quote {
return format!("'{}'", reference.replace('\'', "\\'"));
}
if has_double_quote {
return format!("'{}'", reference);
}
if has_single_quote {
return format!("\"{}\"", reference);
}
if needs_quoting {
return format!("'{}'", reference);
}
reference.to_string()
}
fn needs_parentheses(s: &str) -> bool {
s.contains(' ') || s.contains(':') || s.contains('(') || s.contains(')')
}
fn format_value<T: ToString>(value: &LiNo<T>) -> String {
match value {
LiNo::Ref(r) => escape_reference(&r.to_string()),
LiNo::Link { id, values } => {
if values.is_empty() {
if let Some(ref id_val) = id {
return escape_reference(&id_val.to_string());
}
return String::new();
}
format!("{}", value)
}
}
}
macro_rules! impl_tuple_from {
(@str_tuple 2, $t0:tt, $t1:tt) => {
impl From<(&str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![LiNo::Ref(tuple.$t1.to_string())],
}
}
}
};
(@string_tuple 2, $t0:tt, $t1:tt) => {
impl From<(String, String)> for LiNo<String> {
fn from(tuple: (String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![LiNo::Ref(tuple.$t1)],
}
}
}
};
(@str_lino_tuple 2, $t0:tt, $t1:tt) => {
impl From<(&str, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1],
}
}
}
};
(@lino_tuple 2, $t0:tt, $t1:tt) => {
impl From<(LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1],
}
}
}
};
(@str_tuple 3, $t0:tt, $t1:tt, $t2:tt) => {
impl From<(&str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![LiNo::Ref(tuple.$t1.to_string()), LiNo::Ref(tuple.$t2.to_string())],
}
}
}
};
(@string_tuple 3, $t0:tt, $t1:tt, $t2:tt) => {
impl From<(String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![LiNo::Ref(tuple.$t1), LiNo::Ref(tuple.$t2)],
}
}
}
};
(@str_lino_tuple 3, $t0:tt, $t1:tt, $t2:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2],
}
}
}
};
(@lino_tuple 3, $t0:tt, $t1:tt, $t2:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2],
}
}
}
};
(@str_tuple 4, $t0:tt, $t1:tt, $t2:tt, $t3:tt) => {
impl From<(&str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
],
}
}
}
};
(@string_tuple 4, $t0:tt, $t1:tt, $t2:tt, $t3:tt) => {
impl From<(String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![LiNo::Ref(tuple.$t1), LiNo::Ref(tuple.$t2), LiNo::Ref(tuple.$t3)],
}
}
}
};
(@str_lino_tuple 4, $t0:tt, $t1:tt, $t2:tt, $t3:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3],
}
}
}
};
(@lino_tuple 4, $t0:tt, $t1:tt, $t2:tt, $t3:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3],
}
}
}
};
(@str_tuple 5, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt) => {
impl From<(&str, &str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
LiNo::Ref(tuple.$t4.to_string()),
],
}
}
}
};
(@string_tuple 5, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt) => {
impl From<(String, String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![
LiNo::Ref(tuple.$t1),
LiNo::Ref(tuple.$t2),
LiNo::Ref(tuple.$t3),
LiNo::Ref(tuple.$t4),
],
}
}
}
};
(@str_lino_tuple 5, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4],
}
}
}
};
(@lino_tuple 5, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4],
}
}
}
};
(@str_tuple 6, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt) => {
impl From<(&str, &str, &str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
LiNo::Ref(tuple.$t4.to_string()),
LiNo::Ref(tuple.$t5.to_string()),
],
}
}
}
};
(@string_tuple 6, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt) => {
impl From<(String, String, String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![
LiNo::Ref(tuple.$t1),
LiNo::Ref(tuple.$t2),
LiNo::Ref(tuple.$t3),
LiNo::Ref(tuple.$t4),
LiNo::Ref(tuple.$t5),
],
}
}
}
};
(@str_lino_tuple 6, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5],
}
}
}
};
(@lino_tuple 6, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5],
}
}
}
};
(@str_tuple 7, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt) => {
impl From<(&str, &str, &str, &str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
LiNo::Ref(tuple.$t4.to_string()),
LiNo::Ref(tuple.$t5.to_string()),
LiNo::Ref(tuple.$t6.to_string()),
],
}
}
}
};
(@string_tuple 7, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt) => {
impl From<(String, String, String, String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![
LiNo::Ref(tuple.$t1),
LiNo::Ref(tuple.$t2),
LiNo::Ref(tuple.$t3),
LiNo::Ref(tuple.$t4),
LiNo::Ref(tuple.$t5),
LiNo::Ref(tuple.$t6),
],
}
}
}
};
(@str_lino_tuple 7, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6],
}
}
}
};
(@lino_tuple 7, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6],
}
}
}
};
(@str_tuple 8, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt) => {
impl From<(&str, &str, &str, &str, &str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str, &str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
LiNo::Ref(tuple.$t4.to_string()),
LiNo::Ref(tuple.$t5.to_string()),
LiNo::Ref(tuple.$t6.to_string()),
LiNo::Ref(tuple.$t7.to_string()),
],
}
}
}
};
(@string_tuple 8, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt) => {
impl From<(String, String, String, String, String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String, String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![
LiNo::Ref(tuple.$t1),
LiNo::Ref(tuple.$t2),
LiNo::Ref(tuple.$t3),
LiNo::Ref(tuple.$t4),
LiNo::Ref(tuple.$t5),
LiNo::Ref(tuple.$t6),
LiNo::Ref(tuple.$t7),
],
}
}
}
};
(@str_lino_tuple 8, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7],
}
}
}
};
(@lino_tuple 8, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7],
}
}
}
};
(@str_tuple 9, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt) => {
impl From<(&str, &str, &str, &str, &str, &str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str, &str, &str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
LiNo::Ref(tuple.$t4.to_string()),
LiNo::Ref(tuple.$t5.to_string()),
LiNo::Ref(tuple.$t6.to_string()),
LiNo::Ref(tuple.$t7.to_string()),
LiNo::Ref(tuple.$t8.to_string()),
],
}
}
}
};
(@string_tuple 9, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt) => {
impl From<(String, String, String, String, String, String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String, String, String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![
LiNo::Ref(tuple.$t1),
LiNo::Ref(tuple.$t2),
LiNo::Ref(tuple.$t3),
LiNo::Ref(tuple.$t4),
LiNo::Ref(tuple.$t5),
LiNo::Ref(tuple.$t6),
LiNo::Ref(tuple.$t7),
LiNo::Ref(tuple.$t8),
],
}
}
}
};
(@str_lino_tuple 9, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7, tuple.$t8],
}
}
}
};
(@lino_tuple 9, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7, tuple.$t8],
}
}
}
};
(@str_tuple 10, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt) => {
impl From<(&str, &str, &str, &str, &str, &str, &str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str, &str, &str, &str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
LiNo::Ref(tuple.$t4.to_string()),
LiNo::Ref(tuple.$t5.to_string()),
LiNo::Ref(tuple.$t6.to_string()),
LiNo::Ref(tuple.$t7.to_string()),
LiNo::Ref(tuple.$t8.to_string()),
LiNo::Ref(tuple.$t9.to_string()),
],
}
}
}
};
(@string_tuple 10, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt) => {
impl From<(String, String, String, String, String, String, String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String, String, String, String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![
LiNo::Ref(tuple.$t1),
LiNo::Ref(tuple.$t2),
LiNo::Ref(tuple.$t3),
LiNo::Ref(tuple.$t4),
LiNo::Ref(tuple.$t5),
LiNo::Ref(tuple.$t6),
LiNo::Ref(tuple.$t7),
LiNo::Ref(tuple.$t8),
LiNo::Ref(tuple.$t9),
],
}
}
}
};
(@str_lino_tuple 10, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7, tuple.$t8, tuple.$t9],
}
}
}
};
(@lino_tuple 10, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7, tuple.$t8, tuple.$t9],
}
}
}
};
(@str_tuple 11, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt, $t10:tt) => {
impl From<(&str, &str, &str, &str, &str, &str, &str, &str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str, &str, &str, &str, &str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
LiNo::Ref(tuple.$t4.to_string()),
LiNo::Ref(tuple.$t5.to_string()),
LiNo::Ref(tuple.$t6.to_string()),
LiNo::Ref(tuple.$t7.to_string()),
LiNo::Ref(tuple.$t8.to_string()),
LiNo::Ref(tuple.$t9.to_string()),
LiNo::Ref(tuple.$t10.to_string()),
],
}
}
}
};
(@string_tuple 11, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt, $t10:tt) => {
impl From<(String, String, String, String, String, String, String, String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String, String, String, String, String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![
LiNo::Ref(tuple.$t1),
LiNo::Ref(tuple.$t2),
LiNo::Ref(tuple.$t3),
LiNo::Ref(tuple.$t4),
LiNo::Ref(tuple.$t5),
LiNo::Ref(tuple.$t6),
LiNo::Ref(tuple.$t7),
LiNo::Ref(tuple.$t8),
LiNo::Ref(tuple.$t9),
LiNo::Ref(tuple.$t10),
],
}
}
}
};
(@str_lino_tuple 11, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt, $t10:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7, tuple.$t8, tuple.$t9, tuple.$t10],
}
}
}
};
(@lino_tuple 11, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt, $t10:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7, tuple.$t8, tuple.$t9, tuple.$t10],
}
}
}
};
(@str_tuple 12, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt, $t10:tt, $t11:tt) => {
impl From<(&str, &str, &str, &str, &str, &str, &str, &str, &str, &str, &str, &str)> for LiNo<String> {
fn from(tuple: (&str, &str, &str, &str, &str, &str, &str, &str, &str, &str, &str, &str)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![
LiNo::Ref(tuple.$t1.to_string()),
LiNo::Ref(tuple.$t2.to_string()),
LiNo::Ref(tuple.$t3.to_string()),
LiNo::Ref(tuple.$t4.to_string()),
LiNo::Ref(tuple.$t5.to_string()),
LiNo::Ref(tuple.$t6.to_string()),
LiNo::Ref(tuple.$t7.to_string()),
LiNo::Ref(tuple.$t8.to_string()),
LiNo::Ref(tuple.$t9.to_string()),
LiNo::Ref(tuple.$t10.to_string()),
LiNo::Ref(tuple.$t11.to_string()),
],
}
}
}
};
(@string_tuple 12, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt, $t10:tt, $t11:tt) => {
impl From<(String, String, String, String, String, String, String, String, String, String, String, String)> for LiNo<String> {
fn from(tuple: (String, String, String, String, String, String, String, String, String, String, String, String)) -> Self {
LiNo::Link {
id: Some(tuple.$t0),
values: vec![
LiNo::Ref(tuple.$t1),
LiNo::Ref(tuple.$t2),
LiNo::Ref(tuple.$t3),
LiNo::Ref(tuple.$t4),
LiNo::Ref(tuple.$t5),
LiNo::Ref(tuple.$t6),
LiNo::Ref(tuple.$t7),
LiNo::Ref(tuple.$t8),
LiNo::Ref(tuple.$t9),
LiNo::Ref(tuple.$t10),
LiNo::Ref(tuple.$t11),
],
}
}
}
};
(@str_lino_tuple 12, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt, $t10:tt, $t11:tt) => {
impl From<(&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (&str, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: Some(tuple.$t0.to_string()),
values: vec![tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7, tuple.$t8, tuple.$t9, tuple.$t10, tuple.$t11],
}
}
}
};
(@lino_tuple 12, $t0:tt, $t1:tt, $t2:tt, $t3:tt, $t4:tt, $t5:tt, $t6:tt, $t7:tt, $t8:tt, $t9:tt, $t10:tt, $t11:tt) => {
impl From<(LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)> for LiNo<String> {
fn from(tuple: (LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>, LiNo<String>)) -> Self {
LiNo::Link {
id: None,
values: vec![tuple.$t0, tuple.$t1, tuple.$t2, tuple.$t3, tuple.$t4, tuple.$t5, tuple.$t6, tuple.$t7, tuple.$t8, tuple.$t9, tuple.$t10, tuple.$t11],
}
}
}
};
(2) => {
impl_tuple_from!(@str_tuple 2, 0, 1);
impl_tuple_from!(@string_tuple 2, 0, 1);
impl_tuple_from!(@str_lino_tuple 2, 0, 1);
impl_tuple_from!(@lino_tuple 2, 0, 1);
};
(3) => {
impl_tuple_from!(@str_tuple 3, 0, 1, 2);
impl_tuple_from!(@string_tuple 3, 0, 1, 2);
impl_tuple_from!(@str_lino_tuple 3, 0, 1, 2);
impl_tuple_from!(@lino_tuple 3, 0, 1, 2);
};
(4) => {
impl_tuple_from!(@str_tuple 4, 0, 1, 2, 3);
impl_tuple_from!(@string_tuple 4, 0, 1, 2, 3);
impl_tuple_from!(@str_lino_tuple 4, 0, 1, 2, 3);
impl_tuple_from!(@lino_tuple 4, 0, 1, 2, 3);
};
(5) => {
impl_tuple_from!(@str_tuple 5, 0, 1, 2, 3, 4);
impl_tuple_from!(@string_tuple 5, 0, 1, 2, 3, 4);
impl_tuple_from!(@str_lino_tuple 5, 0, 1, 2, 3, 4);
impl_tuple_from!(@lino_tuple 5, 0, 1, 2, 3, 4);
};
(6) => {
impl_tuple_from!(@str_tuple 6, 0, 1, 2, 3, 4, 5);
impl_tuple_from!(@string_tuple 6, 0, 1, 2, 3, 4, 5);
impl_tuple_from!(@str_lino_tuple 6, 0, 1, 2, 3, 4, 5);
impl_tuple_from!(@lino_tuple 6, 0, 1, 2, 3, 4, 5);
};
(7) => {
impl_tuple_from!(@str_tuple 7, 0, 1, 2, 3, 4, 5, 6);
impl_tuple_from!(@string_tuple 7, 0, 1, 2, 3, 4, 5, 6);
impl_tuple_from!(@str_lino_tuple 7, 0, 1, 2, 3, 4, 5, 6);
impl_tuple_from!(@lino_tuple 7, 0, 1, 2, 3, 4, 5, 6);
};
(8) => {
impl_tuple_from!(@str_tuple 8, 0, 1, 2, 3, 4, 5, 6, 7);
impl_tuple_from!(@string_tuple 8, 0, 1, 2, 3, 4, 5, 6, 7);
impl_tuple_from!(@str_lino_tuple 8, 0, 1, 2, 3, 4, 5, 6, 7);
impl_tuple_from!(@lino_tuple 8, 0, 1, 2, 3, 4, 5, 6, 7);
};
(9) => {
impl_tuple_from!(@str_tuple 9, 0, 1, 2, 3, 4, 5, 6, 7, 8);
impl_tuple_from!(@string_tuple 9, 0, 1, 2, 3, 4, 5, 6, 7, 8);
impl_tuple_from!(@str_lino_tuple 9, 0, 1, 2, 3, 4, 5, 6, 7, 8);
impl_tuple_from!(@lino_tuple 9, 0, 1, 2, 3, 4, 5, 6, 7, 8);
};
(10) => {
impl_tuple_from!(@str_tuple 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
impl_tuple_from!(@string_tuple 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
impl_tuple_from!(@str_lino_tuple 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
impl_tuple_from!(@lino_tuple 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
};
(11) => {
impl_tuple_from!(@str_tuple 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
impl_tuple_from!(@string_tuple 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
impl_tuple_from!(@str_lino_tuple 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
impl_tuple_from!(@lino_tuple 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
};
(12) => {
impl_tuple_from!(@str_tuple 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
impl_tuple_from!(@string_tuple 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
impl_tuple_from!(@str_lino_tuple 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
impl_tuple_from!(@lino_tuple 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
};
}
impl_tuple_from!(2);
impl_tuple_from!(3);
impl_tuple_from!(4);
impl_tuple_from!(5);
impl_tuple_from!(6);
impl_tuple_from!(7);
impl_tuple_from!(8);
impl_tuple_from!(9);
impl_tuple_from!(10);
impl_tuple_from!(11);
impl_tuple_from!(12);
impl From<Vec<&str>> for LiNo<String> {
fn from(values: Vec<&str>) -> Self {
LiNo::Link {
id: None,
values: values
.into_iter()
.map(|s| LiNo::Ref(s.to_string()))
.collect(),
}
}
}
impl From<Vec<String>> for LiNo<String> {
fn from(values: Vec<String>) -> Self {
LiNo::Link {
id: None,
values: values.into_iter().map(LiNo::Ref).collect(),
}
}
}
impl From<Vec<LiNo<String>>> for LiNo<String> {
fn from(values: Vec<LiNo<String>>) -> Self {
LiNo::Link { id: None, values }
}
}
impl From<(&str, Vec<&str>)> for LiNo<String> {
fn from((id, values): (&str, Vec<&str>)) -> Self {
LiNo::Link {
id: Some(id.to_string()),
values: values
.into_iter()
.map(|s| LiNo::Ref(s.to_string()))
.collect(),
}
}
}
impl From<(String, Vec<String>)> for LiNo<String> {
fn from((id, values): (String, Vec<String>)) -> Self {
LiNo::Link {
id: Some(id),
values: values.into_iter().map(LiNo::Ref).collect(),
}
}
}
impl From<(&str, Vec<LiNo<String>>)> for LiNo<String> {
fn from((id, values): (&str, Vec<LiNo<String>>)) -> Self {
LiNo::Link {
id: Some(id.to_string()),
values,
}
}
}
impl From<(String, Vec<LiNo<String>>)> for LiNo<String> {
fn from((id, values): (String, Vec<LiNo<String>>)) -> Self {
LiNo::Link {
id: Some(id),
values,
}
}
}