Skip to content

Commit e702f23

Browse files
committed
Documentation
1 parent 6aa07af commit e702f23

File tree

7 files changed

+284
-253
lines changed

7 files changed

+284
-253
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def print_cons_list(list):
7171

7272
data = gen_list(5, 1000)
7373
cons_list = to_cons_list(data)
74-
book.set_cmd(benda.BendCommand.Cuda)
74+
book.set_cmd(benda.BendRuntime.Cuda)
7575
sorted_list = book.defs.Sort(cons_list)
7676
sorted_list = sorted_list.to_adt(book.adts.List)
7777
print_cons_list(sorted_list)

crates/benda/src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ use pyo3::exceptions::PyException;
4545
use pyo3::prelude::*;
4646
use pyo3::types::{PyDict, PyFunction, PyString, PyTuple};
4747
use rustpython_parser::{parse, Mode};
48-
use types::book::{BendCommand, Book};
48+
use types::book::{BendRuntime, Book};
4949
use types::fan::Fan;
50-
use types::tree::{Leaf, Node, Tree};
5150
use types::u24::U24;
52-
mod benda_ffi;
51+
pub mod benda_ffi;
5352
mod parser;
54-
mod types;
53+
pub mod types;
5554

5655
#[pyfunction]
5756
fn switch() -> PyResult<String> {
@@ -77,7 +76,7 @@ fn switch() -> PyResult<String> {
7776
/// book.defs.Example()
7877
/// ```
7978
#[pyfunction]
80-
fn load_book(py: Python, code: Py<PyString>) -> PyResult<Py<Book>> {
79+
pub fn load_book(py: Python, code: Py<PyString>) -> PyResult<Py<Book>> {
8180
let builtins = bend::fun::Book::builtins();
8281
let path = Path::new("./tmp/bend_book.tmp");
8382
let bend_book = bend::fun::load_book::do_parse_book(
@@ -110,7 +109,10 @@ fn load_book(py: Python, code: Py<PyString>) -> PyResult<Py<Book>> {
110109
/// book.defs.Example()
111110
/// ```
112111
#[pyfunction]
113-
fn load_book_from_file(py: Python, path: Py<PyString>) -> PyResult<Py<Book>> {
112+
pub fn load_book_from_file(
113+
py: Python,
114+
path: Py<PyString>,
115+
) -> PyResult<Py<Book>> {
114116
let binding = path.to_string();
115117
let new_path = Path::new(&binding);
116118
let bend_book = bend::load_file_to_book(new_path);
@@ -285,12 +287,9 @@ fn benda(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
285287
m.add_function(wrap_pyfunction!(switch, m)?)?;
286288
m.add_function(wrap_pyfunction!(load_book_from_file, m)?)?;
287289
m.add_function(wrap_pyfunction!(load_book, m)?)?;
288-
m.add_class::<BendCommand>()?;
290+
m.add_class::<BendRuntime>()?;
289291
m.add_class::<PyBjit>()?;
290292
m.add_class::<U24>()?;
291-
m.add_class::<Tree>()?;
292-
m.add_class::<Node>()?;
293-
m.add_class::<Leaf>()?;
294293
m.add_class::<Fan>()?;
295294
Ok(())
296295
}

0 commit comments

Comments
 (0)