我正在寻找在项目中使用新的erlang地图,但我想确保-spec我所做的一切.所以我的问题是,这是什么语法?是否存在可以指定字段类型的记录?或者我只是使用map()(甚至是正确的类型规范?)
我正在尝试将我的桌面屏幕转换为ffserver并将其作为webm进行流式传输.我正在使用以下ffserver配置:
<Feed feed1.ffm> # This is the input feed where FFmpeg will send
File ./feed1.ffm # video stream.
FileMaxSize 1G # Maximum file size for buffering video
ACL allow 127.0.0.1
ACL allow localhost
</Feed>
<Stream test.webm> # Output stream URL definition
Feed feed1.ffm # Feed from which to receive video
Format webm
# Audio settings
AudioCodec vorbis
AudioBitRate 64 # Audio bitrate
# Video settings
VideoCodec libvpx
VideoSize 720x576 # Video resolution
VideoFrameRate 25 # Video FPS
AVOptionVideo cpu-used 10 …Run Code Online (Sandbox Code Playgroud) 示例代码:
#include <stdio.h>
class compArray {
public:
unsigned int* myArr; //The array
compArray() {
unsigned int temp[4];
for (unsigned int i=0;i<4;i++) {
temp[i] = 0;
}
myArr = temp;
print_arr(myArr);
}
void set() {
print_arr(myArr);
}
static void print_arr(unsigned int* arr) {
printf("Printing the array============\n");
for (unsigned int i=0;i<4;i++) {
printf("%u\n",arr[i]);
}
printf("\n");
}
};
main() {
compArray test;
test.set();
}
Run Code Online (Sandbox Code Playgroud)
输出:
打印数组============
0
0
0
0打印阵列============
134513919
3221174380
0
0
我确信这很简单,我很想念,但为什么会这样呢?
我很生锈,并开始掌握所有权制度等等,但我仍然有一些挂断.例如,我有以下代码:
fn main() {
let mut t = vec![Box::new(4)];
let mut o = t[0];
*o = *o + 1;
t[0] = o;
println!("t[0]:{}", t[0]);
}
Run Code Online (Sandbox Code Playgroud)
这给了cannot move out of indexed content我正在初始化的行的错误o.我知道为什么会发生这种情况,我想,但我无法弄清楚我应该做什么而不是完成同样的事情.这是一个非常简化的案例,但任何帮助将不胜感激.谢谢!