diff --git a/components/profile_traits/lib.rs b/components/profile_traits/lib.rs index 25dbb0b4c5b..1a20a02c234 100644 --- a/components/profile_traits/lib.rs +++ b/components/profile_traits/lib.rs @@ -2,5 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +//! This module contains APIs for the `profile` crate used generically in the +//! rest of Servo. These APIs are here instead of in `profile` so that these +//! modules won't have to depend on `profile`. + pub mod mem; pub mod time; diff --git a/components/profile_traits/mem.rs b/components/profile_traits/mem.rs index f31e6f73358..4b4bd2a59f9 100644 --- a/components/profile_traits/mem.rs +++ b/components/profile_traits/mem.rs @@ -2,12 +2,21 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +//! APIs for memory profiling. + +#![deny(missing_docs)] + use std::sync::mpsc::Sender; +/// Front-end representation of the profiler used to communicate with the +/// profiler. #[derive(Clone)] pub struct ProfilerChan(pub Sender); impl ProfilerChan { + /// Send `msg` on this `Sender`. + /// + /// Panics if the send fails. pub fn send(&self, msg: ProfilerMsg) { let ProfilerChan(ref c) = *self; c.send(msg).unwrap(); @@ -28,6 +37,9 @@ pub struct Report { pub struct ReportsChan(pub Sender>); impl ReportsChan { + /// Send `report` on this `Sender`. + /// + /// Panics if the send fails. pub fn send(&self, report: Vec) { let ReportsChan(ref c) = *self; c.send(report).unwrap();