lib.rs 859 B

123456789101112131415161718192021222324252627282930313233343536
  1. //! # Nostr Protocol Types
  2. //!
  3. //! The types needed to interact with a Nostr relayer, or to be become one.
  4. #![deny(missing_docs, warnings)]
  5. pub mod account;
  6. pub mod client;
  7. pub mod common;
  8. pub mod relayer;
  9. pub mod request;
  10. pub mod response;
  11. pub mod types;
  12. pub use self::{request::Request, response::Response};
  13. #[macro_use]
  14. extern crate custom_derive;
  15. #[macro_use]
  16. extern crate enum_derive;
  17. #[cfg(test)]
  18. mod regression {
  19. use crate::types::Event;
  20. #[test]
  21. fn event() {
  22. include_str!("../tests/regression_parsing.json")
  23. .lines()
  24. .for_each(|line| {
  25. let event: Event = serde_json::from_str(line).unwrap_or_else(|_| {
  26. panic!("Failed to parse: {}", line);
  27. });
  28. assert!(event.is_valid().is_ok(), "Failed to validate: {}", line);
  29. });
  30. }
  31. }