Code format cleanup

pull/10/head
Tpt 7 years ago
parent fec8868065
commit dda9c8e5b7
  1. 6
      src/model/data.rs
  2. 2
      src/rio/ntriples/mod.rs
  3. 6
      src/rio/turtle/mod.rs

@ -1,13 +1,13 @@
///! Implements data structures for https://www.w3.org/TR/rdf11-concepts/ ///! Implements data structures for https://www.w3.org/TR/rdf11-concepts/
///! Inspired by [RDFjs](http://rdf.js.org/) ///! Inspired by [RDFjs](http://rdf.js.org/)
use std::fmt; use std::fmt;
use std::ops::Deref;
use std::option::Option; use std::option::Option;
use std::str::FromStr; use std::str::FromStr;
use std::sync::Arc; use std::sync::Arc;
use url::ParseError; use url::ParseError;
use url::Url; use url::Url;
use uuid::Uuid; use uuid::Uuid;
use std::ops::Deref;
/// A RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri) /// A RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri)
#[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Hash)] #[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Hash)]
@ -77,9 +77,7 @@ impl fmt::Display for BlankNode {
impl Default for BlankNode { impl Default for BlankNode {
/// Builds a new RDF [blank node](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node) with a unique id /// Builds a new RDF [blank node](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node) with a unique id
fn default() -> Self { fn default() -> Self {
BlankNode { BlankNode { id: Uuid::new_v4() }
id: Uuid::new_v4()
}
} }
} }

@ -6,10 +6,10 @@ mod grammar {
use model::data::*; use model::data::*;
use rio::*; use rio::*;
use std::collections::BTreeMap;
use std::io::BufRead; use std::io::BufRead;
use std::io::BufReader; use std::io::BufReader;
use std::io::Read; use std::io::Read;
use std::collections::BTreeMap;
pub fn read_ntriples<'a, R: Read + 'a>(source: R) -> impl Iterator<Item = RioResult<Triple>> { pub fn read_ntriples<'a, R: Read + 'a>(source: R) -> impl Iterator<Item = RioResult<Triple>> {
//TODO: use read_lines to avoid allocations //TODO: use read_lines to avoid allocations

@ -5,19 +5,19 @@ mod grammar {
use model::data::*; use model::data::*;
use rio::*; use rio::*;
use std::collections::BTreeMap;
use std::collections::HashMap; use std::collections::HashMap;
use std::io::BufReader; use std::io::BufReader;
use std::io::Read; use std::io::Read;
use url::ParseOptions; use url::ParseOptions;
use url::Url; use url::Url;
use std::collections::BTreeMap;
pub struct ParserState { pub struct ParserState {
base_uri: Option<Url>, base_uri: Option<Url>,
namespaces: HashMap<String, String>, namespaces: HashMap<String, String>,
cur_subject: Vec<NamedOrBlankNode>, cur_subject: Vec<NamedOrBlankNode>,
cur_predicate: Vec<NamedNode>, cur_predicate: Vec<NamedNode>,
bnodes_map: BTreeMap<String, BlankNode> bnodes_map: BTreeMap<String, BlankNode>,
} }
impl ParserState { impl ParserState {
@ -35,7 +35,7 @@ mod grammar {
namespaces: HashMap::default(), namespaces: HashMap::default(),
cur_subject: Vec::default(), cur_subject: Vec::default(),
cur_predicate: Vec::default(), cur_predicate: Vec::default(),
bnodes_map: BTreeMap::default() bnodes_map: BTreeMap::default(),
}; };
let mut triple_buffer = Vec::default(); let mut triple_buffer = Vec::default();

Loading…
Cancel
Save