droid_wrap::java::lang

Struct Float

Source
pub struct Float { /* private fields */ }
Expand description

Float 类将原始类型浮点的值包装在对象中。Float 类型的对象包含一个类型为浮点的字段。此外,此类还提供了几种将浮点转换为字符串和将字符串转换为浮点的方法,以及处理浮点时有用的其他常量和方法。浮点相等、等价和比较 java.lang.Double 类讨论了浮点值的相等、等价和比较,其中相等适用于浮点值。

Implementations§

Source§

impl Float

Source

pub fn new(value: f32) -> Self

👎Deprecated: 很少适合使用此构造函数。静态工厂 valueOf(float) 通常是更好的选择,因为它可能会产生更好的空间和时间性能。

构造一个新分配的 Float 对象,该对象表示原始 float 参数。 value Float 要表示的值。

Source

pub fn value_of(f: f32) -> Result<Self, <Self as JType>::Error>

返回表示指定浮点值的 Float 实例。如果不需要新的 Float 实例,则通常应优先使用此方法而不是构造函数 Float(float),因为此方法可能会通过缓存频繁请求的值来显著提高空间和时间性能。 返回:表示 f 的 Float 实例。 f 浮点值。

Methods from Deref<Target = Object>§

Source

pub fn hash_code(&self) -> i32

返回对象的哈希码值。此方法支持哈希表,例如 java.util.HashMap 提供的哈希表。 hashCode 的一般约定是:在 Java 应用程序执行期间,只要对同一对象多次调用该方法,则 hashCode 方法必须始终返回相同的整数,前提是未修改对象上 equals 比较中使用的信息。此整数不必在应用程序的一次执行和同一应用程序的另一次执行之间保持一致。如果根据 equals(Object) 方法,两个对象相等,则对这两个对象中的每一个调用 hashCode 方法必须产生相同的整数结果。如果根据 equals(Object) 方法,两个对象不相等,则对这两个对象中的每一个调用 hashCode 方法不必产生不同的整数结果。 但是,程序员应该知道,为不相等的对象产生不同的整数结果可能会提高哈希表的性能。在合理可行的范围内,Object 类定义的 hashCode 方法确实会为不同的对象返回不同的整数。 (hashCode 可能被实现为某个时间点的对象内存地址的某个函数,也可能不被实现。) 返回:此对象的哈希码值。

Methods from Deref<Target = GlobalRef>§

Source

pub fn as_obj(&self) -> &JObject<'static>

Get the object from the global ref

This borrows the ref and prevents it from being dropped as long as the JObject sticks around.

Methods from Deref<Target = JObject<'static>>§

Source

pub fn as_raw(&self) -> *mut _jobject

Returns the raw JNI pointer.

Trait Implementations§

Source§

impl Debug for Float

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Float

Source§

type Target = Object

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Float

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl From<&GlobalRef> for Float

Source§

fn from(obj: &GlobalRef) -> Self

Converts to this type from the input type.
Source§

impl Into<GlobalRef> for &Float

Source§

fn into(self) -> GlobalRef

Converts this type into the (usually inferred) input type.
Source§

impl JObjNew for Float

Source§

type Fields = ()

字段类型
Source§

fn _new(this: &GlobalRef, fields: Self::Fields) -> Self

从java对象创建本地对象。 this java对象引用。
Source§

fn null() -> Self
where Self: Sized, Self::Fields: Default,

创建空对象。
Source§

impl JObjRef for Float

Source§

fn java_ref(&self) -> GlobalRef

获取java对象引用。
Source§

impl JType for Float

Source§

const CLASS: &'static str = "java/lang/Float"

java类的名称。
Source§

const OBJECT_SIG: &'static str = "Ljava/lang/Float;"

对象的签名描述。
Source§

type Error = Error

错误类型。
Source§

const DIM: u8 = 0u8

数组维度,0表示不是数组
Source§

impl PartialEq for Float

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToString for Float

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more

Auto Trait Implementations§

§

impl Freeze for Float

§

impl RefUnwindSafe for Float

§

impl Send for Float

§

impl Sync for Float

§

impl Unpin for Float

§

impl UnwindSafe for Float

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.