rtop_dev/
lib.rs

1//! Rtop SDK to create plugin, made with ❤️ for you.
2//! ## Example Usage
3//! Firstly, create a new project for your plugin!
4//! ```
5//! cargo new --lib MyPlugin
6//! ```
7//! After that, update your `Cargo.toml` file. It should look like that:
8//! ```toml
9//! [package]
10//! name = "MyPlugin"
11//! version = "0.1.0"
12//! edition = "2021"
13//!
14//! [dependencies]
15//! rtop_dev = "^1.0.0"
16//!
17//! [lib]
18//! name = "my_plugin"
19//! crate-type = ["cdylib"]
20//!
21//! [profile.release]
22//! codegen-units = 1
23//! panic = "abort"
24//! strip = true
25//! lto = true
26//! ```
27//! Then, edit your `src/lib.rs` to have somethings like this:
28//! ```rust
29//! struct FooWidget {}
30//!
31//! impl rtop_dev::plugin::Plugin for FooWidget {
32//!     fn display(&mut self, _height: i32, _width: i32) -> String {
33//!         String::from("Hello World RTop!")
34//!     }
35//! }
36//!
37//! #[no_mangle]
38//! pub extern "Rust" fn init_foo() -> (Box<dyn rtop_dev::plugin::Plugin>, bool) {
39//!     (Box::new(FooWidget{}), false)
40//! }
41
42#![allow(
43    clippy::implicit_return,
44    clippy::missing_panics_doc,
45    clippy::missing_errors_doc,
46    clippy::missing_docs_in_private_items,
47    clippy::separated_literal_suffix,
48    clippy::missing_inline_in_public_items,
49    clippy::non_ascii_literal,
50    clippy::must_use_candidate,
51    clippy::mod_module_files,
52    clippy::else_if_without_else,
53    clippy::unused_self,
54    clippy::cast_precision_loss,
55    clippy::print_stdout,
56    clippy::print_stderr,
57    clippy::exit,
58    clippy::too_many_lines,
59    clippy::exhaustive_structs,
60    clippy::single_char_lifetime_names,
61    clippy::integer_division,
62    clippy::separated_literal_suffix,
63    clippy::else_if_without_else,
64    clippy::indexing_slicing,
65    clippy::cast_possible_truncation,
66    clippy::integer_arithmetic,
67    clippy::default_numeric_fallback,
68    clippy::cast_possible_wrap,
69    clippy::cast_sign_loss,
70    clippy::float_arithmetic,
71    clippy::pattern_type_mismatch,
72    clippy::as_conversions
73)]
74#![deny(
75    clippy::needless_return,
76    clippy::str_to_string,
77    clippy::implicit_clone,
78    clippy::needless_pass_by_value,
79    clippy::semicolon_if_nothing_returned,
80    clippy::wildcard_imports,
81    clippy::single_match_else,
82    clippy::single_match,
83    clippy::let_underscore_drop,
84    clippy::expect_used,
85    clippy::suboptimal_flops,
86    clippy::redundant_else
87)]
88
89pub mod components;
90pub mod widget;