Skip to content

Commit

Permalink
Rust 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
sthiele committed Dec 15, 2018
1 parent 0755505 commit 5761094
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 56 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ categories = ["api-bindings"]
license = "MIT"
repository = "https://github.com/sthiele/clingo-rs"
documentation = "https://docs.rs/clingo"
edition = "2018"

[dependencies]
clingo-sys = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion src/ast.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ::*;
use crate::*;

#[derive(Debug, Copy, Clone, PartialEq)]
pub enum StatementType {
Expand Down
4 changes: 1 addition & 3 deletions src/examples/ast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

pub struct OnStatementData<'a> {
atom: ast::Atom,
Expand Down
4 changes: 1 addition & 3 deletions src/examples/backend.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

fn print_model(model: &Model) {
// retrieve the symbols in the model
Expand Down
4 changes: 1 addition & 3 deletions src/examples/configuration.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

fn print_model(model: &Model) {
// retrieve the symbols in the model
Expand Down
4 changes: 1 addition & 3 deletions src/examples/control.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

fn print_model(model: &Model) {
// retrieve the symbols in the model
Expand Down
4 changes: 1 addition & 3 deletions src/examples/inject-terms.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

fn print_model(model: &Model) {
// retrieve the symbols in the model
Expand Down
4 changes: 1 addition & 3 deletions src/examples/model.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

fn print_model(model: &Model, label: &str, show: &ShowType) {
print!("{}:", label);
Expand Down
8 changes: 3 additions & 5 deletions src/examples/propagator.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
extern crate clingo;

use std::env;
use std::vec::Vec;
use clingo::*;
use std::cell::RefCell;
use std::env;
use std::rc::Rc;
use clingo::*;
use std::vec::Vec;

fn print_model(model: &Model) {
// retrieve the symbols in the model
Expand Down
7 changes: 2 additions & 5 deletions src/examples/solve-async.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
extern crate clingo;
extern crate rand;

use std::env;
use clingo::*;
use rand::distributions::{IndependentSample, Range};
use std::env;
use std::sync::atomic::{AtomicBool, Ordering};
use clingo::*;

struct MySEHandler {
atom: AtomicBool,
Expand Down
4 changes: 1 addition & 3 deletions src/examples/statistics.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

fn print_prefix(depth: u8) {
for _ in 0..depth {
Expand Down
2 changes: 0 additions & 2 deletions src/examples/symbol.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate clingo;

use clingo::*;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
Expand Down
4 changes: 1 addition & 3 deletions src/examples/symbolic-atoms.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

fn main() {
// collect clingo options from the command line
Expand Down
4 changes: 1 addition & 3 deletions src/examples/theory-atoms.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
extern crate clingo;

use std::env;
use clingo::*;
use std::env;

fn print_model(model: &Model) {
// retrieve the symbols in the model
Expand Down
2 changes: 0 additions & 2 deletions src/examples/version.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate clingo;

fn main() {
let (mo, mi, re) = clingo::version();
println!("Hello, this is clingo version {}.{}.{}.", mo, mi, re);
Expand Down
23 changes: 9 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
#![feature(ptr_internals)]
#![allow(non_upper_case_globals)]
#[macro_use]
extern crate bitflags;
extern crate clingo_sys;
extern crate failure;
#[macro_use]
extern crate failure_derive;
extern crate libc;

use std::mem;
use std::ptr::Unique;
use std::marker::PhantomData;
use bitflags::bitflags;
use clingo_sys::*;
use libc::c_char;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use std::ffi::CStr;
use std::ffi::CString;
use std::ffi::NulError;
use std::hash::{Hash, Hasher};
use std::marker::PhantomData;
use std::mem;
use std::str::Utf8Error;
use libc::c_char;
use clingo_sys::*;
pub use failure::Error;

use failure::*;
// pub use failure::Error;

/// Functions and data structures to work with program ASTs.
pub mod ast;
Expand Down

0 comments on commit 5761094

Please sign in to comment.