mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
format components/profile_traits
This commit is contained in:
parent
6cb39fad47
commit
ce9231c471
5 changed files with 96 additions and 57 deletions
|
@ -10,12 +10,18 @@ use time;
|
|||
use time::ProfilerCategory;
|
||||
use time::ProfilerChan;
|
||||
|
||||
pub struct IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize {
|
||||
pub struct IpcReceiver<T>
|
||||
where
|
||||
T: for<'de> Deserialize<'de> + Serialize,
|
||||
{
|
||||
ipc_receiver: ipc::IpcReceiver<T>,
|
||||
time_profile_chan: ProfilerChan,
|
||||
}
|
||||
|
||||
impl<T> IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize {
|
||||
impl<T> IpcReceiver<T>
|
||||
where
|
||||
T: for<'de> Deserialize<'de> + Serialize,
|
||||
{
|
||||
pub fn recv(&self) -> Result<T, bincode::Error> {
|
||||
time::profile(
|
||||
ProfilerCategory::IpcReceiver,
|
||||
|
@ -34,8 +40,12 @@ impl<T> IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn channel<T>(time_profile_chan: ProfilerChan) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error>
|
||||
where T: for<'de> Deserialize<'de> + Serialize, {
|
||||
pub fn channel<T>(
|
||||
time_profile_chan: ProfilerChan,
|
||||
) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error>
|
||||
where
|
||||
T: for<'de> Deserialize<'de> + Serialize,
|
||||
{
|
||||
let (ipc_sender, ipc_receiver) = ipc::channel()?;
|
||||
let profiled_ipc_receiver = IpcReceiver {
|
||||
ipc_receiver,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue