Commit Graph

41 Commits (7e6c6d8976398b83b8e4feba78816d6cc27d8f90)

Author SHA1 Message Date
joseLuís 797ef4b0ae rust: more changes and improvements
- raw field of new wrapping structs is now public just to the crate.
- NcNotcurses.stdplane method now doesn't return an NcResult since it can't fail.
- rename NcNotcurses to Notcurses and NcNotcursesOptions to NotcursesOptions.
- rename NcPlane::new_termsize constructor to with_termsize.
- bump MSV to 1.48 for the doc links.
- improve lib documentation.
- minor fixes.
4 years ago
joseLuís bad3449205 rust: rename Notcurses to FullMode; update doc 4 years ago
joseLuís f5f9397f7b rust: add new wrapper type over NcDirect called DirectMode. 4 years ago
joseLuís 6b2805937d rust: add new wrapper type over notcurses struct.
Create new wrapping types that can safely encapsulate the mutable references,
and implement Drop and automatic (de)referencing.

- Notcurses
  - rename Notcurses* to NcNotcurses*.
  - rename NotcursesOptions to NcNotcursesOptions.
  - new Notcurses struct.
    - implement Drop, AsRef, AsMut, Deref & DerefMut.
    - override stop method to be no-op.
    - reimplement constructors and associated methods.
  - remove without_altscreen_with_banners constructor.
- update examples and tests.
- rustfmt.
4 years ago
joseLuís 3bf9f11c80 rust: improve direct-cursor example.
- add `rand` as a dev-dependency.
4 years ago
joseLuís 9156cec58f rust: add handy constructors for NcChannel
- fix direct-cursor example.
4 years ago
joseLuís 500456e2e5 rust: continue working on the poc-menu example.
- change return type of NcMenu.selected to Option.
- change type to &str in ncplane_set_base.
- bonus: update some comments.
4 years ago
joseLuís 1d4653e7c8 rust: rename NcInput's new() to new_empty(); add new() 4 years ago
joseLuís 5e7bf86b9c rust: almost complete poc-menu example, still has bugs.
- add NcMenuSection::new_separator() constructor.
- rename constructor method for an empty NcInput to new();
- fix notcurses_getc_blocking() function name and error logic.
- improve comments.
- change type of NCMENU_OPTION_* to u64 (like in C API)
- fix error_str![] macro.
- improve error messages.
4 years ago
joseLuís 31e7305ce8 rust: start improving errors reporting.
- refactor error![] macro, switch place for $msg & $ok parameters.
- add more meaningful NcError return values in several functions related with poc-menu example, for starters.
- the poc-menu example now doesn't randomly fail, IDKW but OK I guess.
- minor unrelated corrections.
4 years ago
joseLuís 8e5e60f588 rust: Continue with poc-menu example.
- add NcPlane.pustr_aligned() method.
- disable notcurses_stddim_yx* functions & methods for now.
- make input argument optional for notcurses_getc_nblocking().
- update full-basics example.
- fix comments.
4 years ago
joseLuís 7b4c105fdf rust: finish updating rust for ncdirect changes
- update function and method names.
- update intra-doc links.
- update examples.
4 years ago
joseLuís 55d49a43f6 rust: continue NcMenu PoC example; fixes
- modify ncmenu constructor Accept &mut[] instead of Vec<> to avoid FFI related problems. Furthermore, from rust 1.48 it's easy to convert a Vec into an array using the std::convert::TryInto trait.
- fix ncmenu method names.
- fix & refactor Notcurses contructors; add `with_debug` constructor.
- make NcPlane.set_base receive a char instead of a reference, since it's copy.
- add `rre` cargo alias for running examples on release.
4 years ago
joseLuís a880eaf018 rust: new NcMenu PoC example & more error refactoring.
- new example poc-menu (WIP).
- improve constructors for NcMenu*.
- divide NcMenu* methods into submodules.
- fix return type for NcPlane constructors.
- use NcResult on functions returning references.
- fix a couple of Notcurses methods.
- add more NcChannelPair methods.
- refactor NcInput constructors.
- rename error_ptr![] to error_ref_mut![]
- new macro cstring_mut![].
- new error_ref![] macro.
- update examples & tests.
- bump version in readme.
4 years ago
joseLuís 2762e9e561 rust: refactor errors for NcPlane & NcReader.
- add ncplane_new_bound_test helper function.
- update examples & tests as needed.
- rustfmt & minor fixes.
4 years ago
joseLuís fbe4352233 rust: refactor sleep macros
- receive a variable number of arguments.
- make rsleep use methods and deal with NcResult.
- new fsleep to flush an NcDirect context.
- fix macro usages in examples.
4 years ago
joseLuís 36e81a573a rust: finish NcDirect & Notcurses methods.
- add missing NcDirect methods: raster_frame & render_frame.
- finish refactoring Notcurses methods.
  - turn more Option returns into NcResult.
4 years ago
joseLuís 6049e07d27 rust: continue refactoring the error system.
- made const NotcursesOptions constructors.
- refactor Notcurses constructors to return NcResult.
- pass NotcursesOptions by value, since it's Copy.
- update tests.
- add helper modules for Notcurses & NcPlane.
  - new initialization functions to be used in tests.
- BONUS:
  - refactor NcDirect
  - update examples.
4 years ago
joseLuís b12abeddc9 rust: finish NcDirect error system refactor
- change Option return type for NcResult when appropriate.
- make NcDirect constructors return NcResult.
- rename NcError::new() to with_msg() and simplify new().
- refactor examples:
  - rename direct-image.rs to direct-image-c.rs
  - recreate using rust methods, as direct-image-rust.rs
  - differentiate more throughly between both styles.
  - remove the sys namespace on both examples.
4 years ago
joseLuís 1687af89e0 rust: refactor error system.
We need to use Result<> to manage error flow,
at least on the methods API. This way it will
finally feel idiomatic Rust and more concise.
Also, we can't return a non Result from main.

- rename NcResult to NcIntResult.
- new NcError & NcResult types.
- new error![] macro to reduce boilerplate.
- change return type of NcDirect methods to NcResult.
  - refactor several examples to return NcResult:
    direct-cursor, poc-direct & poc-kittyzapper.
- BONUS: fix test not stopping notcurses context.
- update lib doc-comment.
- fix typo in readme.
4 years ago
joseLuís 5d1dfe1d02 rust fix poc-direct; update readme deps badge 4 years ago
joseLuís ab2675b358 rust: add poc-direct example
- fix NcDirect dim_[y|x] methods.
- add NcDirect.dim_yx() method.
4 years ago
joseLuís a9413eafb2 rust: add poc-kittyzapper example
- fix ncdirect_[b|f]g_rgb8 functions.
- fix NcDirect.bg_rgb8 method.
- new printf![] macro.
4 years ago
joseLuís b62c1ec74b rust: refactor NcCell constructors 4 years ago
joseLuís c07b68f783 rust: add example poc-cjkscroll 4 years ago
joseLuís 4cca3ddd48 rust: working on input
- make char: all NCKEY_* constants.
- make const fn: nckey_mouse_p, ncinput_equal_p & NcInput::new.
- make rsleep!() return the notcurses_render() result.
- new Notcurses constructor with_flags().
- new example: full-input.rs.
- fix comments.
4 years ago
joseLuís 38bdc627a4 rust: more refactoring
- new macros module, with sleep![] and cstring![] macros.
- rename NCell constructors.
- more plane methods.
- improve doc comments.
4 years ago
joseLuís b64a257ecf rust: replace cell macros with constructors
- add NcCell constructors: new(), new_blank(), with_char()
- remove cell initializer macros
- update full-basics example
- add more doc comments
4 years ago
joseLuís 4de2652f8d rust: more fixes and improvements
- fix notcurses_init unit test
- fix fn call name: `nplane_at_cursor_cell` → `ncplane_at_cursor_cell`.
- make LIBC_FILE & NC_FILE type aliases with doc comment.
- add lib module comment.
- improve direct-cursor example.
- fix full-text example and rename it to full-basics.
4 years ago
joseLuís 107cb05fce rust: refactor examples 4 years ago
joseLuís 08b000de28 rust: remove no_std; fix #1119 4 years ago
joseLuís 08a0da358e rust: continue reworking the API & improve documentation
- remove _IO_FILE import and usage.
- create handy constructors for NcDirect & Notcurses.
  (but can't implement destructors for copy types…).
- when possible substitute mutable pointers `*mut` for mutable references `&mut`
  with associated lifetimes.
- new widgets module, starting with NcReader & NcReaderOptions constructors
4 years ago
joseLuís 4673a86ea2 rust: API refactor & improve documentation
- rename EGC to Egc, EGCBackstop to EgcBackstop and ChannelPair to Channels.
- make the original type aliased structs non-public (e.g. ncdirect, ncalign…)
- fix and improve documentation for several types.
- revert renaming crate to nc on use.
- directly import the used types at the beginning of the module.

Now the rustdoc generated documentation is much cleaner.
4 years ago
joseLuís d59d05990b rust: direct mode changes
- rename ncdirect_start to ncdirect_new
- add direct mode option flags
- fix examples
- refactor comments
4 years ago
joseLuís bcc5481899 rust: update example
- use ncdirect_flush function for flushing
4 years ago
joseLuís a09ed747ca rust: update example direct-cursor 4 years ago
joseLuís ed748a5162 rust: new example: direct cursor
issue: only updates the screen after a newline
4 years ago
joseLuís 9dc847c8b5 rust: add simple wrapper over ncdirect_init 4 years ago
joseLuís 4382487652 rust: update example 4 years ago
joseLuís d9596883d3 rust: make examples no_std compatible too 4 years ago
joseLuís e22232774d rust: add direct-image example 4 years ago