lewp_css/serializers/
serialize_dimension.rs

1// This file is part of css. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2017 The developers of css. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css/master/COPYRIGHT.
3
4use {crate::domain::numbers::CssNumber, std::fmt};
5
6/// Serialize a value with given unit into dest.
7pub(crate) fn serialize_dimension<W: fmt::Write, Number: CssNumber>(
8    value: Number,
9    unit: &str,
10    dest: &mut W,
11) -> fmt::Result {
12    value.to_css(dest)?;
13    dest.write_str(unit)
14}