如何获取从另一个函数struct返回的 a的值Result?下面举例。
#[derive(Debug)]
pub struct Keypair(ed25519_dalek::Keypair);
pub fn keypair_from_seed(seed: &[u8]) -> Result<Keypair, Box<dyn error::Error>> {
let dalek_keypair = ed25519_dalek::Keypair { secret, public };
Ok(Keypair(dalek_keypair))
}
Run Code Online (Sandbox Code Playgroud)
fn main(){
//here seed_bytes is mnemonics
let sk = keypair_from_seed(&seed_bytes);
//sk contains the secret key and public key, i want to extract it different secret key & public key
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的 Telerik 应用程序构建器“ https://github.com/fechanique/cordova-plugin-fcm ”中使用 FCM 进行推送通知我收到错误 “命名空间前缀 android 未定义”并且我的函数getToken不起作用
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-fcm"
version="2.1.1">
<name>FCMPlugin</name>
<description>Cordova FCM Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova, fcm, push, plugin</keywords>
<info>
Cordova FCM plugin v2.1.1 installed
For more details visit https://github.com/fechanique/cordova-plugin-fcm
</info>
<js-module src="www/FCMPlugin.js" name="FCMPlugin">
<clobbers target="FCMPlugin" />
</js-module>
<engines>
<engine name="cordova-android" version=">=4.0.0" />
</engines>
<!-- ANDROID CONFIGURATION -->
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:exported="true" android:name="com.gae.scaffolder.plugin.FCMPluginActivity" android:launchMode="singleTop">
<intent-filter>
<action android:name="FCM_PLUGIN_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter> …Run Code Online (Sandbox Code Playgroud)