mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-12-22 16:35:51 -05:00
Downgrade to 2018 edition (support rust-analyzer)
This commit is contained in:
parent
bd7d083107
commit
010a420465
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "nostr-rs-relay"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
|
|
@ -51,15 +51,14 @@ where
|
|||
|
||||
impl Event {
|
||||
pub fn parse(json: &str) -> Result<Event> {
|
||||
let e: Event = serde_json::from_str(json)?;
|
||||
let _e: Event = serde_json::from_str(json)?;
|
||||
Err(Error::EventParseFailed)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::event::Event;
|
||||
use serde_json::Result;
|
||||
use super::*;
|
||||
fn simple_event() -> Event {
|
||||
super::Event {
|
||||
id: 0,
|
||||
|
@ -112,7 +111,6 @@ mod tests {
|
|||
#[test]
|
||||
fn event_deserialize() -> Result<()> {
|
||||
let raw_json = r#"{"id":"1384757da583e6129ce831c3d7afc775a33a090578f888dd0d010328ad047d0c","pubkey":"bbbd9711d357df4f4e498841fd796535c95c8e751fa35355008a911c41265fca","created_at":1612650459,"kind":1,"tags":null,"content":"hello world","sig":"59d0cc47ab566e81f72fe5f430bcfb9b3c688cb0093d1e6daa49201c00d28ecc3651468b7938642869ed98c0f1b262998e49a05a6ed056c0d92b193f4e93bc21"}"#;
|
||||
|
||||
// id: 1384757da583e6129ce831c3d7afc775a33a090578f888dd0d010328ad047d0c
|
||||
// pubkey: bbbd9711d357df4f4e498841fd796535c95c8e751fa35355008a911c41265fca",
|
||||
// created_at: 1612650459
|
||||
|
@ -120,7 +118,6 @@ mod tests {
|
|||
// tags":null,
|
||||
// "content":"hello world",
|
||||
// "sig":"59d0cc47ab566e81f72fe5f430bcfb9b3c688cb0093d1e6daa49201c00d28ecc3651468b7938642869ed98c0f1b262998e49a05a6ed056c0d92b193f4e93bc21"}]"#;
|
||||
|
||||
let e: Event = serde_json::from_str(raw_json)?;
|
||||
// assert that the kind is 1
|
||||
assert_eq!(e.kind, 1);
|
||||
|
|
|
@ -7,18 +7,7 @@ use serde::{Deserialize, Deserializer, Serialize};
|
|||
// Container for a request filter
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct ReqCmd {
|
||||
|
||||
#[serde(deserialize_with = "u32_from_string")]
|
||||
id: u32,
|
||||
#[serde(deserialize_with = "u32_from_string")]
|
||||
pubkey: u32,
|
||||
created_at: u64,
|
||||
kind: u8,
|
||||
#[serde(deserialize_with = "tag_from_string")]
|
||||
tags: Vec<Vec<String>>,
|
||||
content: String,
|
||||
#[serde(deserialize_with = "u64_from_string")]
|
||||
sig: u64,
|
||||
cmds: Vec<String>
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
|
@ -39,5 +28,3 @@ pub struct ReqFilter {
|
|||
since: Option<u64>,
|
||||
authors: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
pub struct Request {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user