feature(relay): add transfer struct to store announced transfers
This commit is contained in:
parent
76e48923d5
commit
faab74e3b5
2 changed files with 36 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ pub mod appstate;
|
|||
pub mod client;
|
||||
pub mod room;
|
||||
pub mod server;
|
||||
pub mod transfer;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
|||
35
src/relay/transfer.rs
Normal file
35
src/relay/transfer.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct Transfer {
|
||||
pub name: String,
|
||||
pub ip: String,
|
||||
pub room_id: String,
|
||||
}
|
||||
|
||||
impl Transfer {
|
||||
pub fn new(name: String, ip: String, room_id: String) -> Self {
|
||||
Self { name, ip, room_id }
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_new() {
|
||||
let transfer = Transfer {
|
||||
name: "Test".to_string(),
|
||||
ip: "127.0.0.1".to_string(),
|
||||
room_id: "This_is_a_test_room_id".to_string(),
|
||||
};
|
||||
assert_eq!(
|
||||
Transfer::new(
|
||||
"Test".to_string(),
|
||||
"127.0.0.1".to_string(),
|
||||
"This_is_a_test_room_id".to_string()
|
||||
),
|
||||
transfer
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue