mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 10:56:29 +03:00
Note JsonRPC API
This commit is contained in:
8
STYLE.md
8
STYLE.md
@@ -167,10 +167,14 @@ Follow Rust guidelines for the documentation comments:
|
|||||||
For internal types, implementing `From`, `TryFrom` or `FromStr` is discouraged.
|
For internal types, implementing `From`, `TryFrom` or `FromStr` is discouraged.
|
||||||
Instead, a `new()` function is recommended.
|
Instead, a `new()` function is recommended.
|
||||||
|
|
||||||
For external types, use `Type::from()`, `Type::try_from()` or `Type::from_str()` directly
|
For external types, prefer using `Type::from()`, `Type::try_from()` or `Type::from_str()`
|
||||||
rather than `into()`, `try_into()` or `parse()`.
|
over `into()`, `try_into()` or `parse()`.
|
||||||
|
|
||||||
Calling `into()`, `try_into()` or `parse()`
|
Calling `into()`, `try_into()` or `parse()`
|
||||||
creates an indirection,
|
creates an indirection,
|
||||||
which is hard to follow for people who are not familiar with Rust,
|
which is hard to follow for people who are not familiar with Rust,
|
||||||
or who are not using rust-analyzer.
|
or who are not using rust-analyzer.
|
||||||
|
|
||||||
|
A notable exception is the Json-RPC API bindings,
|
||||||
|
where the API types have `From` implementatons to and from the core types.
|
||||||
|
Here, it is assumed to be clear enough which code is called.
|
||||||
|
|||||||
Reference in New Issue
Block a user