Skip to content

Commit

Permalink
fix rtc-ic/state_test.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrtc committed Mar 9, 2024
1 parent 26773b7 commit 5a29845
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rtc-ice/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use stun::xoraddr::*;

use crate::agent::agent_transport::*;
use crate::candidate::*;
use crate::connection_state::*;
use crate::rand::*;
use crate::state::*;
use crate::url::*;
use shared::error::*;

Expand Down
2 changes: 1 addition & 1 deletion rtc-ice/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pub mod agent;
pub mod attributes;
pub mod candidate;
pub mod connection_state;
pub mod rand;
pub mod state;
pub mod stats;
pub mod url;
44 changes: 44 additions & 0 deletions rtc-ice/src/connection_state/mod.rs → rtc-ice/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,47 @@ impl From<u8> for ConnectionState {
}
}
}

/// Describes the state of the candidate gathering process.
#[derive(PartialEq, Eq, Copy, Clone)]
pub enum GatheringState {
Unspecified,

/// Indicates candidate gathering is not yet started.
New,

/// Indicates candidate gathering is ongoing.
Gathering,

/// Indicates candidate gathering has been completed.
Complete,
}

impl From<u8> for GatheringState {
fn from(v: u8) -> Self {
match v {
1 => Self::New,
2 => Self::Gathering,
3 => Self::Complete,
_ => Self::Unspecified,
}
}
}

impl Default for GatheringState {
fn default() -> Self {
Self::Unspecified
}
}

impl fmt::Display for GatheringState {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = match *self {
Self::New => "new",
Self::Gathering => "gathering",
Self::Complete => "complete",
Self::Unspecified => "unspecified",
};
write!(f, "{s}")
}
}
File renamed without changes.

0 comments on commit 5a29845

Please sign in to comment.