Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add serde::Serialize support for AisMessage #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

salsabiljb
Copy link
Contributor

  • Implemented serde::Serialize for the AisMessage enum and all its variants:
    * This enables serialization of AIS messages into JSON format.
  • Implemented the fmt::Display trait for AisMessage:
    *This provides a readable string representation for each AisMessage variant.

src/messages/mod.rs Fixed Show fixed Hide fixed
src/messages/mod.rs Fixed Show resolved Hide resolved
src/messages/addressed_safety_related.rs Fixed Show fixed Hide fixed
src/messages/aid_to_navigation_report.rs Fixed Show fixed Hide fixed
src/messages/binary_acknowledge.rs Fixed Show fixed Hide fixed
src/messages/binary_addressed.rs Fixed Show fixed Hide fixed
src/messages/binary_broadcast_message.rs Fixed Show fixed Hide fixed
src/messages/interrogation.rs Fixed Show fixed Hide fixed
src/messages/interrogation.rs Fixed Show fixed Hide fixed
src/messages/safety_related_acknowledgment.rs Fixed Show fixed Hide fixed
src/messages/safety_related_broadcast.rs Fixed Show fixed Hide fixed
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

use serde_json::Error as SerdeError;

/// Serializes an `AisSentence` to JSON
pub fn serialize_to_json(sentence: &AisSentence) -> std::result::Result<String, SerdeError> {

Check failure

Code scanning / clippy

failed to resolve: use of undeclared crate or module std Error

failed to resolve: use of undeclared crate or module std
use serde_json::Error as SerdeError;

/// Serializes an `AisSentence` to JSON
pub fn serialize_to_json(sentence: &AisSentence) -> std::result::Result<String, SerdeError> {

Check failure

Code scanning / clippy

cannot find type String in this scope Error

cannot find type String in this scope
}

/// Deserializes an `AisSentence` from JSON
pub fn deserialize_from_json(json_data: &str) -> std::result::Result<AisSentence, SerdeError> {

Check failure

Code scanning / clippy

failed to resolve: use of undeclared crate or module std Error

failed to resolve: use of undeclared crate or module std
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant