Commit Graph

93 Commits

Author SHA1 Message Date
joseLuís
1c5ee9eb8c rust: add more functions and methods
- add functions: ncdirect_core_init & notcurses_core_init (methods pending)
- add functions & methods: ncdirect_readline & notcurses_can_braille
- minor fixes
2021-04-05 19:34:39 +02:00
joseLuís
5492119263 rust: add *_check_pixel_support functions + example 2021-04-05 11:16:34 +02:00
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.
2021-01-03 02:40:41 +01:00
joseLuís
bad3449205 rust: rename Notcurses to FullMode; update doc 2021-01-02 22:58:35 +01:00
joseLuís
f5f9397f7b rust: add new wrapper type over NcDirect called DirectMode. 2021-01-02 22:50:48 +01:00
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.
2021-01-02 19:45:15 +01:00
joseLuís
3bf9f11c80 rust: improve direct-cursor example.
- add `rand` as a dev-dependency.
2021-01-01 21:47:41 +01:00
joseLuís
9156cec58f rust: add handy constructors for NcChannel
- fix direct-cursor example.
2021-01-01 20:56:30 +01:00
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.
2021-01-01 14:17:01 +01:00
joseLuís
1d4653e7c8 rust: rename NcInput's new() to new_empty(); add new() 2021-01-01 13:59:30 +01:00
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.
2020-12-31 00:11:49 +01:00
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.
2020-12-30 19:11:55 +01:00
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.
2020-12-30 18:40:54 +01:00
joseLuís
7b4c105fdf rust: finish updating rust for ncdirect changes
- update function and method names.
- update intra-doc links.
- update examples.
2020-12-29 02:56:01 +01:00
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.
2020-12-27 19:00:32 +01:00
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.
2020-12-26 20:29:06 +01:00
joseLuís
2762e9e561 rust: refactor errors for NcPlane & NcReader.
- add ncplane_new_bound_test helper function.
- update examples & tests as needed.
- rustfmt & minor fixes.
2020-12-26 07:34:26 +01:00
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.
2020-12-26 05:14:27 +01:00
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.
2020-12-25 20:10:31 +01:00
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.
2020-12-25 19:35:21 +01:00
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.
2020-12-25 17:41:02 +01:00
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.
2020-12-25 05:16:34 +01:00
joseLuís
5d1dfe1d02 rust fix poc-direct; update readme deps badge 2020-12-25 00:53:03 +01:00
joseLuís
ab2675b358 rust: add poc-direct example
- fix NcDirect dim_[y|x] methods.
- add NcDirect.dim_yx() method.
2020-12-24 19:56:12 +01:00
joseLuís
a9413eafb2 rust: add poc-kittyzapper example
- fix ncdirect_[b|f]g_rgb8 functions.
- fix NcDirect.bg_rgb8 method.
- new printf![] macro.
2020-12-24 18:40:33 +01:00
joseLuís
b62c1ec74b rust: refactor NcCell constructors 2020-12-24 03:04:46 +01:00
joseLuís
c07b68f783 rust: add example poc-cjkscroll 2020-12-23 21:50:23 +01:00
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.
2020-12-16 23:15:29 +01:00
joseLuís
38bdc627a4 rust: more refactoring
- new macros module, with sleep![] and cstring![] macros.
- rename NCell constructors.
- more plane methods.
- improve doc comments.
2020-12-03 04:30:13 +01:00
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
2020-11-26 19:17:08 +01:00
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.
2020-11-18 02:43:29 +01:00
joseLuís
107cb05fce rust: refactor examples 2020-11-16 23:53:07 +01:00
joseLuís
08b000de28 rust: remove no_std; fix #1119 2020-11-15 22:43:22 +01:00
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
2020-11-08 18:35:35 +01:00
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.
2020-11-07 18:34:42 +01:00
joseLuís
d59d05990b rust: direct mode changes
- rename ncdirect_start to ncdirect_new
- add direct mode option flags
- fix examples
- refactor comments
2020-11-04 18:31:12 +01:00
joseLuís
bcc5481899 rust: update example
- use ncdirect_flush function for flushing
2020-09-22 13:34:10 +02:00
joseLuís
a09ed747ca rust: update example direct-cursor 2020-09-21 20:03:18 +02:00
joseLuís
ed748a5162 rust: new example: direct cursor
issue: only updates the screen after a newline
2020-08-20 18:02:03 +02:00
joseLuís
9dc847c8b5 rust: add simple wrapper over ncdirect_init 2020-08-20 16:40:15 +02:00
joseLuís
4382487652 rust: update example 2020-08-17 17:54:07 +02:00
joseLuís
d9596883d3 rust: make examples no_std compatible too 2020-08-13 22:14:00 +02:00
joseLuís
e22232774d rust: add direct-image example 2020-08-12 17:53:50 +02:00