Require documentation for the memory profiling module.

This commit is contained in:
Ms2ger 2015-05-01 12:25:09 +02:00
parent 7355bf1061
commit 5e5be69b01
2 changed files with 16 additions and 0 deletions

View file

@ -2,5 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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 mem;
pub mod time; pub mod time;

View file

@ -2,12 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! APIs for memory profiling.
#![deny(missing_docs)]
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
/// Front-end representation of the profiler used to communicate with the
/// profiler.
#[derive(Clone)] #[derive(Clone)]
pub struct ProfilerChan(pub Sender<ProfilerMsg>); pub struct ProfilerChan(pub Sender<ProfilerMsg>);
impl ProfilerChan { impl ProfilerChan {
/// Send `msg` on this `Sender`.
///
/// Panics if the send fails.
pub fn send(&self, msg: ProfilerMsg) { pub fn send(&self, msg: ProfilerMsg) {
let ProfilerChan(ref c) = *self; let ProfilerChan(ref c) = *self;
c.send(msg).unwrap(); c.send(msg).unwrap();
@ -28,6 +37,9 @@ pub struct Report {
pub struct ReportsChan(pub Sender<Vec<Report>>); pub struct ReportsChan(pub Sender<Vec<Report>>);
impl ReportsChan { impl ReportsChan {
/// Send `report` on this `Sender`.
///
/// Panics if the send fails.
pub fn send(&self, report: Vec<Report>) { pub fn send(&self, report: Vec<Report>) {
let ReportsChan(ref c) = *self; let ReportsChan(ref c) = *self;
c.send(report).unwrap(); c.send(report).unwrap();