Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed various bugs #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/generate_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ fn uses(o: &Output, classes: bool) -> String {
fn write_files(o: &Output, writers: &Writers, folder: &str, classes: bool) -> rome::Result<()> {
let uses = uses(o, classes);
let dir_path = o.output_dir.join(folder);
if !fs::metadata(&dir_path)?.is_dir() {
let metadata = fs::metadata(&dir_path);
if !fs::metadata(&dir_path).is_ok() || !metadata?.is_dir() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if !metadata.is_ok() || !metadata?.is_dir() {

fs::create_dir(&dir_path)?;
}
let path = dir_path.join("mod.rs");
Expand Down
4 changes: 2 additions & 2 deletions src/iter/transitive_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ impl<I, J, F> TransitiveIterator<I, J, F>
for (pos, item) in self.iters.iter_mut().enumerate() {
match (item.1.peek(), min) {
(Some(m), Some(n)) if m < n => {
min_pos = Some(pos);
min_pos = Some(pos + 1);
min = Some(m)
}
(Some(m), None) => {
min_pos = Some(pos);
min_pos = Some(pos + 1);
min = Some(m)
}
_ => {}
Expand Down
7 changes: 6 additions & 1 deletion src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@ use ontology_adapter;
use resource;
use std;

#[macro_export]
macro_rules!
rb{($p:ident) =>
(<<Self as resource::ResourceBase<'g>>::Graph as graph::Graph<'g>>::$p)
}
#[macro_export]
macro_rules!
resource{() =>
(graph::Resource<'g, rb!(BlankNodePtr), rb!(IRIPtr), rb!(LiteralPtr)>)
}
#[macro_export]
macro_rules!
adapter{() =>
(ontology_adapter::OntologyAdapter<'g, Self::Graph>)
}
#[macro_export]
macro_rules!
g{($p:ident) =>
(<G as graph::Graph<'g>>::$p)
}
#[macro_export]
macro_rules!
g_resource{() =>
(graph::Resource<'g, g!(BlankNodePtr), g!(IRIPtr), g!(LiteralPtr)>)
Expand Down Expand Up @@ -347,7 +352,7 @@ impl<'g, G: 'g> resource::ResourceBase<'g> for $name<'g, G>
}
}
fn iter(adapter: &'g adapter!()) -> resource::SubjectIter<'g, Self> {
use graph::IRIPtr;
use self::graph::IRIPtr;
let rdf_type = adapter.preloaded_iri(0);
let class = adapter.preloaded_iri($pos);
let iter = match (rdf_type, class) {
Expand Down