style: Document nsCSSShadowArray sugar.

This commit is contained in:
Emilio Cobos Álvarez 2017-01-02 03:32:55 +01:00
parent 96fb1378d7
commit 2778354455
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -2,6 +2,8 @@
* 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/. */
//! Rust helpers for Gecko's `nsCSSShadowArray`.
use gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread; use gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread;
use gecko_bindings::bindings::Gecko_NewCSSShadowArray; use gecko_bindings::bindings::Gecko_NewCSSShadowArray;
use gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread; use gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread;
@ -10,6 +12,7 @@ use std::{ptr, slice};
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
impl RefPtr<nsCSSShadowArray> { impl RefPtr<nsCSSShadowArray> {
/// Replaces the current `nsCSSShadowArray` with a new one of len `len`.
pub fn replace_with_new(&mut self, len: u32) { pub fn replace_with_new(&mut self, len: u32) {
unsafe { unsafe {
if !self.mRawPtr.is_null() { if !self.mRawPtr.is_null() {
@ -23,6 +26,12 @@ impl RefPtr<nsCSSShadowArray> {
} }
} }
} }
/// Sets the value to other `nsCSSShadowArray`, bumping and decreasing
/// refcounts as needed.
///
/// TODO(emilio): Seems like this could move to `refptr.rs`, and be more
/// generic.
pub fn copy_from(&mut self, other: &Self) { pub fn copy_from(&mut self, other: &Self) {
unsafe { unsafe {
if !self.mRawPtr.is_null() { if !self.mRawPtr.is_null() {