Skip to content

Commit

Permalink
style: fix cfg's and remove empty comments
Browse files Browse the repository at this point in the history
  • Loading branch information
johnstonskj committed Sep 17, 2024
1 parent 642cbdb commit fed7893
Show file tree
Hide file tree
Showing 29 changed files with 86 additions and 175 deletions.
4 changes: 2 additions & 2 deletions rdftk_io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ default = ["dot", "json", "json-ld", "n3", "nq", "nt", "trig", "turtle", "xml"]
dot = []
json = ["serde_json"]
json-ld = ["serde_json"]
n3 = []
n3 = ["pest", "pest_derive"]
nq = ["pest", "pest_derive"]
nt = ["pest", "pest_derive"]
trig = []
trig = ["pest", "pest_derive"]
turtle = ["pest", "pest_derive"]
xml = ["xml-rs", "rdftk_names"]

Expand Down
9 changes: 0 additions & 9 deletions rdftk_io/src/common/indenter.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/*!
One-line description.
More detailed description, with
# Example
*/

use std::fmt::{Display, Formatter};

// ------------------------------------------------------------------------------------------------
Expand Down
14 changes: 9 additions & 5 deletions rdftk_io/src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
/*!
One-line description.
More detailed description, with
# Example
Internal, common, code for reader and writer implementations.
*/

// ------------------------------------------------------------------------------------------------
// Modules
// ------------------------------------------------------------------------------------------------

#[cfg(feature = "nt")]
pub(crate) mod indenter;

#[cfg(any(
feature = "n3",
feature = "nq",
feature = "nt",
feature = "trig",
feature = "turtle"
))]
pub(crate) mod parser;
11 changes: 0 additions & 11 deletions rdftk_io/src/common/parser/n3.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/*!
One-line description.
More detailed description, with
# Example
End of file during parsingSymbol’s value as variable is void: rustEnd of file during parsing
*/

// use ...

// ------------------------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions rdftk_io/src/common/parser/nquads.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::upper_case_acronyms)] // << generated by pest.

use super::ntriples::{object as nt_object, predicate as nt_predicate, subject as nt_subject};
use super::Rule;
use pest::iterators::Pair;
Expand Down
2 changes: 0 additions & 2 deletions rdftk_io/src/common/parser/ntriples.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::upper_case_acronyms)] // << generated by pest.

use super::Rule;
use pest::iterators::Pair;
use rdftk_core::error::Error;
Expand Down
11 changes: 0 additions & 11 deletions rdftk_io/src/common/parser/trig.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/*!
One-line description.
More detailed description, with
# Example
End of file during parsingSymbol’s value as variable is void: rustEnd of file during parsing
*/

// use ...

// ------------------------------------------------------------------------------------------------
Expand Down
11 changes: 0 additions & 11 deletions rdftk_io/src/common/parser/turtle.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/*!
One-line description.
More detailed description, with
# Example
End of file during parsingSymbol’s value as variable is void: rustEnd of file during parsing
*/

// use ...

// ------------------------------------------------------------------------------------------------
Expand Down
15 changes: 15 additions & 0 deletions rdftk_io/src/json/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
/*!
Provides for writing a `Graph` instance in the
W3C [RDF 1.1 JSON Alternate Serialization (RDF/JSON)](https://www.w3.org/TR/rdf-json/) format.
# Example Writer
```rust
use rdftk_io::json::{JsonWriter, JsonOptions};
# use objio::{HasOptions, ObjectWriter};
# use rdftk_core::model::graph::GraphRef;
# fn make_graph() -> GraphRef { rdftk_core::simple::graph::graph_factory().graph() }
let writer = JsonWriter::default()
.with_options(JsonOptions::default().with_pretty_print(true));
let result = writer.write_to_string(&make_graph());
```
*/

// ------------------------------------------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions rdftk_io/src/json/reader.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*!
Provides the `JsonReader` implementation of the `GraphReader` trait.
# Example
*/

use crate::json::syntax::{
BNODE_PREFIX, OBJ_KEY_DATATYPE, OBJ_KEY_LANG, OBJ_KEY_TYPE, OBJ_KEY_VALUE, OBJ_TYPE_BNODE,
OBJ_TYPE_LITERAL, OBJ_TYPE_URI,
Expand Down
18 changes: 0 additions & 18 deletions rdftk_io/src/json/writer.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
/*!
Provides the `JsonWriter` implementation of the `GraphWriter` trait.
```rust
use rdftk_io::json::{JsonWriter, JsonOptions};
# use objio::{HasOptions, ObjectWriter};
# use rdftk_core::model::graph::GraphRef;
# fn make_graph() -> GraphRef { rdftk_core::simple::graph::graph_factory().graph() }
let writer = JsonWriter::default()
.with_options(JsonOptions::default().with_pretty_print(true));
let result = writer.write_to_string(&make_graph());
```
*/

use crate::json::syntax::{
OBJ_KEY_DATATYPE, OBJ_KEY_LANG, OBJ_KEY_TYPE, OBJ_KEY_VALUE, OBJ_TYPE_BNODE, OBJ_TYPE_LITERAL,
OBJ_TYPE_URI,
Expand Down
8 changes: 0 additions & 8 deletions rdftk_io/src/json_ld/reader.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/*!
One-line description.
More detailed description, with
# Example
*/

// use ...

Expand Down
8 changes: 0 additions & 8 deletions rdftk_io/src/json_ld/writer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/*!
One-line description.
More detailed description, with
# Example
*/

// use ...

Expand Down
21 changes: 0 additions & 21 deletions rdftk_io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,6 @@ creation of [GraphViz](https://graphviz.gitlab.io/) dot files for a visualizatio
Each module will also provide public constants `NAME`, `FILE_EXTENSION`, and `MIME_TYPE`.
# Example
An example, reading an existing NTriple file.
```rust
use objio::{HasOptions, ObjectReader};
use rdftk_io::nt::{NTripleReaderOptions, NTripleReader};
use rdftk_core::simple::graph_factory;
use std::fs::File;
use std::path::PathBuf;
let file_path = PathBuf::from("tests/w3c/nt/literal.nt");
let mut file = File::open(file_path).unwrap();
let reader = NTripleReader::default()
.with_options(NTripleReaderOptions::default().with_factory(graph_factory()));
let graph = reader.read(&mut file).unwrap();
```
*/

#![warn(
Expand Down Expand Up @@ -97,7 +79,6 @@ pub mod dot;
pub mod json;

#[cfg(feature = "n3")]
#[doc(hidden)]
pub mod n3;

#[cfg(feature = "nq")]
Expand All @@ -107,11 +88,9 @@ pub mod nq;
pub mod nt;

#[cfg(feature = "trig")]
#[doc(hidden)]
pub mod trig;

#[cfg(feature = "turtle")]
#[doc(hidden)]
pub mod turtle;

#[cfg(feature = "xml")]
Expand Down
1 change: 0 additions & 1 deletion rdftk_io/src/n3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ proposed W3C [Notation3 (N3)](https://www.w3.org/TeamSubmission/n3/), _a readabl
format.
*/


// ------------------------------------------------------------------------------------------------
// Public Values
// ------------------------------------------------------------------------------------------------
Expand Down
9 changes: 0 additions & 9 deletions rdftk_io/src/n3/writer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/*!
One-line description.
More detailed description, with
# Example
*/

// use ...

// ------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion rdftk_io/src/nq/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ format.
Provides the `NQuadDataSetWriter` implementation of the `DataSetWriter` trait and the
`NQuadGraphWriter` implementation of the `GraphWriter` trait.
# Example
# Example Writer
```rust
use rdftk_io::nq::NQuadWriter;
Expand Down
2 changes: 1 addition & 1 deletion rdftk_io/src/nt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ W3C [RDF 1.1 N-Triples](https://www.w3.org/TR/n-triples/), _a line-based syntax
format.
# Writer Example
# Example Writer
```rust
use rdftk_io::nt::NTripleWriter;
Expand Down
9 changes: 0 additions & 9 deletions rdftk_io/src/trig/writer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/*!
One-line description.
More detailed description, with
# Example
*/

use crate::turtle::TurtleOptions;
use objio::{impl_has_options, HasOptions, ObjectWriter};
use rdftk_core::error::Error;
Expand Down
41 changes: 41 additions & 0 deletions rdftk_io/src/turtle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,47 @@
Provides for reading and writing a `Graph` instance in the
[RDF 1.1 Turtle](https://www.w3.org/TR/turtle/), _Terse RDF Triple Language_, format.
# Example Writer
An example, reading an existing NTriple file.
```rust
use objio::{HasOptions, ObjectReader};
use rdftk_io::nt::{NTripleReaderOptions, NTripleReader};
use rdftk_core::simple::graph_factory;
use std::fs::File;
use std::path::PathBuf;
let file_path = PathBuf::from("tests/w3c/nt/literal.nt");
let mut file = File::open(file_path).unwrap();
let reader = NTripleReader::default()
.with_options(NTripleReaderOptions::default().with_factory(graph_factory()));
let graph = reader.read(&mut file).unwrap();
```
# Example Writer with Options
```rust
use rdftk_io::turtle::{TurtleWriter, TurtleOptions};
use rdftk_iri::{IriRef, Iri};
use std::str::FromStr;
# use objio::{HasOptions, ObjectWriter};
# use rdftk_core::model::graph::GraphRef;
# fn make_graph() -> GraphRef { rdftk_core::simple::graph::graph_factory().graph() }
let mut options = TurtleOptions::default()
.with_id_base(Iri::from_str("http://en.wikipedia.org/wiki/").unwrap().into())
.with_sparql_style()
.without_nested_blank_nodes();
let writer = TurtleWriter::default()
.with_options(options);
let result = writer.write_to_string(&make_graph());
```
*/

// ------------------------------------------------------------------------------------------------
Expand Down
25 changes: 0 additions & 25 deletions rdftk_io/src/turtle/writer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
/*!
Provides the `TurtleWriter` implementation of the `GraphWriter` trait.
# Example
```rust
use rdftk_io::turtle::{TurtleWriter, TurtleOptions};
use rdftk_iri::{IriRef, Iri};
use std::str::FromStr;
# use objio::{HasOptions, ObjectWriter};
# use rdftk_core::model::graph::GraphRef;
# fn make_graph() -> GraphRef { rdftk_core::simple::graph::graph_factory().graph() }
let mut options = TurtleOptions::default()
.with_id_base(Iri::from_str("http://en.wikipedia.org/wiki/").unwrap().into())
.with_sparql_style()
.without_nested_blank_nodes();
let writer = TurtleWriter::default()
.with_options(options);
let result = writer.write_to_string(&make_graph());
```
*/

// ------------------------------------------------------------------------------------------------
// Modules
// ------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion rdftk_io/src/xml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Provides for writing out in the [RDF 1.1 XML Syntax](https://www.w3.org/TR/rdf-syntax-grammar/)
format.
# Writer Example
# Example Writer
This writer has a number of options, it can be written in a plain, streaming, form or alternatively
pretty-printed for readability. It is also possible to pick one of the type styles described
Expand Down
17 changes: 4 additions & 13 deletions rdftk_io/src/xml/reader.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
/*!
Provides the `XmlReader` implementation of the `GraphReader` trait.
# Example
*/

// use ...

// ------------------------------------------------------------------------------------------------
// Public Types
// ------------------------------------------------------------------------------------------------

use crate::xml::syntax::{
ATTRIBUTE_ABOUT, ATTRIBUTE_ID, ATTRIBUTE_NODE_ID, ATTRIBUTE_PARSE_TYPE, ATTRIBUTE_RESOURCE,
ATTRIBUTE_XML_BASE, ATTRIBUTE_XML_LANG, ELEMENT_DESCRIPTION, ELEMENT_RDF,
Expand All @@ -32,6 +19,10 @@ use xml::name::OwnedName;
use xml::reader::XmlEvent;
use xml::{EventReader, EventWriter};

// ------------------------------------------------------------------------------------------------
// Public Types
// ------------------------------------------------------------------------------------------------

///
/// An implementation of the GraphReader trait to read resources in the XML representation.
///
Expand Down
Loading

0 comments on commit fed7893

Please sign in to comment.